diff --git a/plasma-conversion/callGeneration.bash b/plasma-conversion/callGeneration.bash
new file mode 100755
index 0000000000000000000000000000000000000000..7707b3addcc40b07485533f3bf7715aa4e225326
--- /dev/null
+++ b/plasma-conversion/callGeneration.bash
@@ -0,0 +1,456 @@
+#!/bin/bash
+###
+#
+# @copyright (c) 2009-2015 The University of Tennessee and The University
+#                          of Tennessee Research Foundation.
+#                          All rights reserved.
+# @copyright (c) 2012-2016 Inria. All rights reserved.
+# @copyright (c) 2012-2015 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
+#
+#
+###
+#
+#  @file callGeneration.bash
+#
+#  @project MORSE
+#  MORSE is a software package provided by:
+#     Inria Bordeaux - Sud-Ouest,
+#     Univ. of Tennessee,
+#     King Abdullah Univesity of Science and Technology
+#     Univ. of California Berkeley,
+#     Univ. of Colorado Denver.
+#
+#  @version 1.0.0
+#  @author Cedric Castagnede
+#  @author Emmanuel Agullo
+#  @author Mathieu Faverge
+#  @author Florent Pruvost
+#  @date 30-11-2015
+#
+###
+
+# plasma release to download
+plasma_relname=2.8.0
+plasma_rel=plasma_$plasma_relname.tar.gz
+plasma_url=http://icl.cs.utk.edu/projectsfiles/plasma/pubs/$plasma_rel
+if [[ ! -e $plasma_rel ]]; then
+    echo "$plasma_rel does not exists, y to download it"
+    wget $plasma_url
+fi
+if [[ ! -e plasma_$plasma_relname ]]; then
+    tar zxf $plasma_rel
+fi
+
+# Define the paths
+# ----------------
+
+# where the script is called
+plasma_conv_dir="$PWD"
+# source files of the conversion (plasma -> chameleon)
+plasma_dir="$PWD/plasma_$plasma_relname"
+# source of the licence
+licence_dir="$PWD/insert-licence"
+# source of the original chameleon
+# ex in this plasma_conversion directory: svn checkout https://scm.gforge.inria.fr/anonscm/svn/morse/trunk/chameleon
+morse_dir="$PWD/.."
+# source of the converted chameleon
+morse_tmp="$PWD/chameleon"
+
+if [[ ! -e $plasma_dir ]]; then
+    echo "plasma_dir is set to $plasma_dir which does not exist, please set the variable plasma_dir in the script $0"
+    exit $?
+fi
+if [[ ! -e $licence_dir ]]; then
+    echo "licence_dir is set to $licence_dir which does not exist, please set the variable licence_dir in the script $0"
+    exit $?
+fi
+if [[ ! -e $morse_dir ]]; then
+    echo "morse_dir is set to $morse_dir which does not exist, try to download it"
+    svn export svn+ssh://fpruvost@scm.gforge.inria.fr/svnroot/morse/trunk/chameleon
+    if [[ ! -e $morse_dir ]]; then
+        echo "morse_dir is set to $morse_dir which does not exist, please set the variable morse_dir in the script $0 and check that this path exists"
+        exit $?
+    fi
+fi
+if [[ ! -e $morse_tmp ]]; then
+    echo "morse_tmp is set to $morse_tmp which does not exist, lets create it"
+    mkdir $morse_tmp
+    if [[ ! -e $morse_tmp ]]; then
+        echo "morse_tmp is set to $morse_tmp which does not exist, please set the variable morse_tmp in the script $0"
+        exit $?
+    fi
+fi
+
+# Definition of files list
+# ------------------------
+list_file="
+include/core_zblas.h
+include/core_zcblas.h
+include/plasma_z.h
+include/plasma_zc.h
+control/compute_z.h
+control/workspace_z.c
+control/plasma_zcf90.F90
+control/plasma_zf77.c
+control/plasma_zf90.F90
+control/plasma_zf90_wrappers.F90
+
+core_blas/core_dzasum.c
+core_blas/core_zgemm.c
+core_blas/core_zgessq.c
+core_blas/core_zhemm.c
+core_blas/core_zhessq.c
+core_blas/core_zher2k.c
+core_blas/core_zherk.c
+core_blas/core_zpemv.c
+core_blas/core_zsymm.c
+core_blas/core_zsyr2k.c
+core_blas/core_zsyrk.c
+core_blas/core_zsyssq.c
+core_blas/core_ztrasm.c
+core_blas/core_ztrmm.c
+core_blas/core_ztrsm.c
+core_blas/core_ztrssq.c
+core_blas/core_zgeadd.c
+core_blas/core_zgelqt.c
+core_blas/core_zgeqrt.c
+core_blas/core_zgessm.c
+core_blas/core_zgetrf.c
+core_blas/core_zgetrf_incpiv.c
+core_blas/core_zgetf2_nopiv.c
+core_blas/core_zgetrf_nopiv.c
+core_blas/core_zlacpy.c
+core_blas/core_zlag2c.c
+core_blas/core_zlange.c
+core_blas/core_zlanhe.c
+core_blas/core_zlansy.c
+core_blas/core_zlantr.c
+core_blas/core_zlaset2.c
+core_blas/core_zlaset.c
+core_blas/core_zlauum.c
+core_blas/core_zpamm.c
+core_blas/core_zparfb.c
+core_blas/core_zplghe.c
+core_blas/core_zplgsy.c
+core_blas/core_zplrnt.c
+core_blas/core_zpltmg.c
+core_blas/core_zpotrf.c
+core_blas/core_zssssm.c
+core_blas/core_ztrtri.c
+core_blas/core_ztslqt.c
+core_blas/core_ztsmlq.c
+core_blas/core_ztsmqr.c
+core_blas/core_ztsqrt.c
+core_blas/core_ztstrf.c
+core_blas/core_zttlqt.c
+core_blas/core_zttmlq.c
+core_blas/core_zttmqr.c
+core_blas/core_zttqrt.c
+core_blas/core_zunmlq.c
+core_blas/core_zunmqr.c
+
+core_blas-qwrapper/qwrapper_dzasum.c
+core_blas-qwrapper/qwrapper_zgemm.c
+core_blas-qwrapper/qwrapper_zgessq.c
+core_blas-qwrapper/qwrapper_zhemm.c
+core_blas-qwrapper/qwrapper_zher2k.c
+core_blas-qwrapper/qwrapper_zherk.c
+core_blas-qwrapper/qwrapper_zpemv.c
+core_blas-qwrapper/qwrapper_zplssq.c
+core_blas-qwrapper/qwrapper_zhessq.c
+core_blas-qwrapper/qwrapper_zsymm.c
+core_blas-qwrapper/qwrapper_zsyr2k.c
+core_blas-qwrapper/qwrapper_zsyrk.c
+core_blas-qwrapper/qwrapper_zsyssq.c
+core_blas-qwrapper/qwrapper_ztrasm.c
+core_blas-qwrapper/qwrapper_ztrmm.c
+core_blas-qwrapper/qwrapper_ztrsm.c
+core_blas-qwrapper/qwrapper_ztrssq.c
+core_blas-qwrapper/qwrapper_zgeadd.c
+core_blas-qwrapper/qwrapper_zgelqt.c
+core_blas-qwrapper/qwrapper_zgeqrt.c
+core_blas-qwrapper/qwrapper_zgessm.c
+core_blas-qwrapper/qwrapper_zgetrf.c
+core_blas-qwrapper/qwrapper_zgetrf_incpiv.c
+core_blas-qwrapper/qwrapper_zgetf2_nopiv.c
+core_blas-qwrapper/qwrapper_zgetrf_nopiv.c
+core_blas-qwrapper/qwrapper_zlacpy.c
+core_blas-qwrapper/qwrapper_zlag2c.c
+core_blas-qwrapper/qwrapper_zlange.c
+core_blas-qwrapper/qwrapper_zlanhe.c
+core_blas-qwrapper/qwrapper_zlansy.c
+core_blas-qwrapper/qwrapper_zlantr.c
+core_blas-qwrapper/qwrapper_zlaset2.c
+core_blas-qwrapper/qwrapper_zlaset.c
+core_blas-qwrapper/qwrapper_zlauum.c
+core_blas-qwrapper/qwrapper_zpamm.c
+core_blas-qwrapper/qwrapper_zparfb.c
+core_blas-qwrapper/qwrapper_zplghe.c
+core_blas-qwrapper/qwrapper_zplgsy.c
+core_blas-qwrapper/qwrapper_zplrnt.c
+core_blas-qwrapper/qwrapper_zpltmg.c
+core_blas-qwrapper/qwrapper_zpotrf.c
+core_blas-qwrapper/qwrapper_zssssm.c
+core_blas-qwrapper/qwrapper_ztrtri.c
+core_blas-qwrapper/qwrapper_ztslqt.c
+core_blas-qwrapper/qwrapper_ztsmlq.c
+core_blas-qwrapper/qwrapper_ztsmqr.c
+core_blas-qwrapper/qwrapper_ztsqrt.c
+core_blas-qwrapper/qwrapper_ztstrf.c
+core_blas-qwrapper/qwrapper_zttlqt.c
+core_blas-qwrapper/qwrapper_zttmlq.c
+core_blas-qwrapper/qwrapper_zttmqr.c
+core_blas-qwrapper/qwrapper_zttqrt.c
+core_blas-qwrapper/qwrapper_zunmlq.c
+
+compute/pzgemm.c
+compute/pzhemm.c
+compute/pzher2k.c
+compute/pzherk.c
+compute/pzsymm.c
+compute/pzsyr2k.c
+compute/pzsyrk.c
+compute/pztrmm.c
+compute/pztrsm.c
+compute/pztrsmpl.c
+compute/pzgeadd.c
+compute/pzgelqf.c
+compute/pzgelqfrh.c
+compute/pzgeqrf.c
+compute/pzgeqrfrh.c
+compute/pzgetrf_incpiv.c
+compute/pzgetrf_nopiv.c
+compute/pzlacpy.c
+compute/pzlag2c.c
+compute/pzlange.c
+compute/pzlanhe.c
+compute/pzlansy.c
+compute/pzlantr.c
+compute/pzlaset2.c
+compute/pzlaset.c
+compute/pzlauum.c
+compute/pzplghe.c
+compute/pzplgsy.c
+compute/pzpltmg.c
+compute/pzpotrf.c
+compute/pztrtri.c
+compute/pzunglq.c
+compute/pzunglqrh.c
+compute/pzungqr.c
+compute/pzungqrrh.c
+compute/pzunmlq.c
+compute/pzunmlqrh.c
+compute/pzunmqr.c
+compute/pzunmqrrh.c
+
+compute/zgels.c
+compute/zgelqs.c
+compute/zgelqf.c
+compute/zgemm.c
+compute/zgeqrf.c
+compute/zgeqrs.c
+compute/zgetrf_incpiv.c
+compute/zgetrf_nopiv.c
+compute/zgetrs_incpiv.c
+compute/zgesv_incpiv.c
+compute/zhemm.c
+compute/zher2k.c
+compute/zherk.c
+compute/zsymm.c
+compute/zsyr2k.c
+compute/zsyrk.c
+compute/ztrmm.c
+compute/ztrsm.c
+compute/ztrsmpl.c
+compute/zlacpy.c
+compute/zlange.c
+compute/zlanhe.c
+compute/zlansy.c
+compute/zlantr.c
+compute/zlaset.c
+compute/zlauum.c
+compute/zplghe.c
+compute/zplgsy.c
+compute/zplrnt.c
+compute/zpltmg.c
+compute/zposv.c
+compute/zpotrf.c
+compute/zpotri.c
+compute/zpotrs.c
+compute/ztrtri.c
+compute/zunglq.c
+compute/zungqr.c
+compute/zunmlq.c
+compute/zunmqr.c
+
+testing/testing_zgemm.c
+testing/testing_zhemm.c
+testing/testing_zher2k.c
+testing/testing_zherk.c
+testing/testing_zlange.c
+testing/testing_zsymm.c
+testing/testing_zsyr2k.c
+testing/testing_zsyrk.c
+testing/testing_ztrmm.c
+testing/testing_ztrsm.c
+testing/testing_zpemv.c
+testing/testing_zposv.c
+testing/testing_zpotri.c
+testing/testing_zgels.c
+testing/testing_zgesv_incpiv.c
+
+timing/time_zgemm.c
+timing/time_zgemm_tile.c
+timing/time_ztrsm.c
+timing/time_zgels.c
+timing/time_zgels_tile.c
+timing/time_zgeqrf.c
+timing/time_zgeqrf_tile.c
+timing/time_zgetrf_incpiv.c
+timing/time_zgetrf_incpiv_tile.c
+timing/time_zgetrf_nopiv.c
+timing/time_zgetri_tile.c
+timing/time_zposv.c
+timing/time_zposv_tile.c
+timing/time_zpotrf.c
+timing/time_zpotrf_tile.c
+timing/time_zpotri_tile.c
+timing/time_zgesv_incpiv.c
+timing/time_zgesv_incpiv_tile.c
+"
+# COREBLAS not used
+# -----------------
+#core_blas/core_zbrdalg.c
+#core_blas/core_zgbelr.c
+#core_blas/core_zgblrx.c
+#core_blas/core_zgbrce.c
+#core_blas/core_zgessq.c
+#core_blas/core_zgetrip.c
+#core_blas/core_zgetrf_reclap.c
+#core_blas/core_zgetrf_rectil.c
+#core_blas/core_zhbelr.c
+#core_blas/core_zhblrx.c
+#core_blas/core_zhbrce.c
+#core_blas/core_zhbtype1cb.c
+#core_blas/core_zhbtype2cb.c
+#core_blas/core_zhbtype3cb.c
+#core_blas/core_zhegst.c
+#core_blas/core_zherfb.c
+#core_blas/core_zlarfb_gemm.c
+#core_blas/core_zlarfx_tbrd.c
+#core_blas/core_zlarfy.c
+#core_blas/core_zlaswp.c
+#core_blas/core_zlatro.c
+#core_blas/core_zshift.c
+#core_blas/core_zswpab.c
+#core_blas/core_ztrdalg.c
+#core_blas/core_ztsmlq_corner.c
+#core_blas/core_ztsmlq_hetra1.c
+#core_blas/core_ztsmqr_corner.c
+#core_blas/core_ztsmqr_hetra1.c
+#core_blas/core_ztsrfb.c
+
+# PCOMPUTE not used
+# -----------------
+#compute/pzgebrd_ge2tb.c
+#compute/pzgebrd_tb2bd.c
+#compute/pzgetmi2.c
+#compute/pzgetrf_reclap.c
+#compute/pzgetrf_rectil.c
+#compute/pzhbcpy_t2bl.c
+#compute/pzhegst.c
+#compute/pzherbt.c
+#compute/pzhetrd_hb2st.c
+#compute/pzhetrd_he2hb.c
+#compute/pzlarft_blgtrd.c
+#compute/pzlaswp.c
+#compute/pzlaswpc.c
+#compute/pztrsmrv.c
+#compute/pzunmqr_blgtrd.c
+#
+#compute/pzbarrier.c
+#compute/pzpack.c
+#compute/pzshift.c
+
+# COMPUTE not used
+# ----------------
+#compute/zgetrf.c
+#compute/zgetri.c
+#compute/zcgels.c
+#compute/zcgesv.c
+#compute/zcposv.c
+#compute/zcungesv.c
+#compute/zgebrd.c
+#compute/zgecfi2.c
+#compute/zgecfi2.h
+#compute/zgecfi.c
+#compute/zgesv.c
+#compute/zgesvd.c
+#compute/zgetmi.c
+#compute/zgetrs.c
+#compute/zheev.c
+#compute/zheevd.c
+#compute/zhegst.c
+#compute/zhegv.c
+#compute/zhegvd.c
+#compute/zhetrd.c
+#compute/zlaswp.c
+#compute/zlaswpc.c
+#compute/ztrsmrv.c
+
+# TIMING not used
+# ---------------
+#timing/time_zgetrf.c
+#timing/time_zgetrf_tile.c
+#timing/time_zcgesv.c
+#timing/time_zcgesv_tile.c
+#timing/time_zcposv.c
+#timing/time_zcposv_tile.c
+#timing/time_zgebrd_tile.c
+#timing/time_zgetrf_reclap.c
+#timing/time_zgetrf_rectil.c
+#timing/time_zgecfi.c
+#timing/time_zgesvd_tile.c
+#timing/time_zheevd_tile.c
+#timing/time_zheev_tile.c
+#timing/time_zhegv_tile.c
+#timing/time_zlapack2tile.c
+#timing/time_zgesv.c
+#timing/time_zgesv_tile.c
+
+# TESTING not used
+# ----------------
+#testing/testing_zcgels.c
+#testing/testing_zcgesv.c
+#testing/testing_zcposv.c
+#testing/testing_zcungesv.c
+#testing/testing_zgecfi.c
+#testing/testing_zgesv.c
+#testing/testing_zgesvd.c
+#testing/testing_zgetmi.c
+#testing/testing_zgetri.c
+#testing/testing_zheev.c
+#testing/testing_zheevd.c
+#testing/testing_zhegst.c
+#testing/testing_zhegv.c
+#testing/testing_zhegvd.c
+#testing/testing_zlange.c
+
+# TIMING not used
+# ----------------
+#timing/zauxiliary.h
+#timing/zauxiliary.c
+
+# Génération des sources
+# ----------------------
+python ${plasma_conv_dir}/generate_morseSrc.py -o ${morse_tmp} -p ${plasma_dir} -f "${list_file}" --force
+
+# Copie de la licence en entête des fichiers générés
+current_dir=$PWD
+cd ${morse_tmp}
+${licence_dir}/insert-licence-chameleon.sh
+cd ${current_dir}
+
+# Recopie de magma_morse
+# ----------------------
+python ${plasma_conv_dir}/generate_morseSrc.py -o ${morse_dir} -m ${morse_tmp} --force
diff --git a/plasma-conversion/fileConversion.py b/plasma-conversion/fileConversion.py
new file mode 100644
index 0000000000000000000000000000000000000000..3bb649e50d93734f4792330f135861be40849f68
--- /dev/null
+++ b/plasma-conversion/fileConversion.py
@@ -0,0 +1,353 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+###
+#
+# -- Inria
+# -- (C) Copyright 2012
+#
+# This software is a computer program whose purpose is to process
+# Matrices Over Runtime Systems @ Exascale (MORSE). More information
+# can be found on the following website: http://www.inria.fr/en/teams/morse.
+# 
+# This software is governed by the CeCILL-C license under French law and
+# abiding by the rules of distribution of free software.  You can  use, 
+# modify and/ or redistribute the software under the terms of the CeCILL-C
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# "http://www.cecill.info". 
+# 
+# As a counterpart to the access to the source code and  rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty  and the software's author,  the holder of the
+# economic rights,  and the successive licensors  have only  limited
+# liability. 
+# 
+# In this respect, the user's attention is drawn to the risks associated
+# with loading,  using,  modifying and/or developing or reproducing the
+# software by the user in light of its specific status of free software,
+# that may mean  that it is complicated to manipulate,  and  that  also
+# therefore means  that it is reserved for developers  and  experienced
+# professionals having in-depth computer knowledge. Users are therefore
+# encouraged to load and test the software's suitability as regards their
+# requirements in conditions enabling the security of their systems and/or 
+# data to be ensured and,  more generally, to use and operate it in the 
+# same conditions as regards security. 
+# 
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-C license and that you accept its terms.
+#
+###
+#
+#  @file fileConversion.py
+#
+#  @project MORSE
+#  MORSE is a software package provided by:
+#     Inria Bordeaux - Sud-Ouest,
+#     Univ. of Tennessee,
+#     King Abdullah Univesity of Science and Technology
+#     Univ. of California Berkeley,
+#     Univ. of Colorado Denver. 
+# 
+#  @version 1.0.0
+#  @author Cedric Castagnede
+#  @author Emmanuel Agullo
+#  @author Mathieu Faverge
+#  @date 13-07-2012
+#   
+###
+
+import sys;
+import os;
+import string;
+
+import re;
+import shutil;
+from rulesSubstitutions import subs;
+
+def read_file(file):
+    fd = open(file, 'r')
+    filedata = fd.read()
+    fd.close()
+    return filedata
+
+
+def write_file(file, filedata):
+    fd = open(file, 'w')
+    fd.write(filedata)
+    fd.close()
+
+
+def update_file(file, filedata):
+    # read previous data
+    fd = open(file, 'r')
+    data = fd.read()
+    fd.close()
+
+    # write new + previous data
+    fd = open(file, 'w')
+    fd.write(filedata + data)
+    fd.close()
+
+
+def create_path(path):
+    path = os.path.abspath(path)
+    if os.path.exists(path) is False:
+        print 'create:',path
+        os.makedirs(path)
+
+def substitute_file(srcfilepath, dstfilepath, filetype):
+    print 'substitute : apply >>>',filetype,'<<< dictionnary'
+    print '             for',dstfilepath
+
+    # Initialize filedata
+    filedata = read_file(srcfilepath)
+
+    # Subsitute in data
+    work = subs[filetype]
+    for pattern in work:
+        condition = pattern[0]
+        search    = pattern[1]
+        replace   = pattern[2]
+        if not search:
+            continue
+        if condition == 'u':
+            filedata = re.sub(re.compile(search, re.M), replace, filedata)
+        if condition == 'r':
+            data_p = re.sub(re.compile(search, re.M), replace, filedata)
+            while data_p != filedata:
+                filedata = data_p
+                data_p = re.sub(re.compile(search, re.M), replace, filedata)
+            filedata = data_p
+
+    # calll the last treatment to remove tabulation
+    filedata = re.sub(re.compile('\t', re.M), '    ', filedata)
+
+    # Write file
+    write_file(dstfilepath, filedata)
+
+
+
+def change_file(srcfile, dstfile, filetype, mode):
+
+    if os.path.exists(srcfile):
+        create_path(os.path.dirname(dstfile))
+
+        if os.path.exists(dstfile):
+            print 'already exists:',dstfile
+            if mode is True:
+                ask = "y"
+            else:
+                ask = ""
+            while (ask != "y") and (ask != "n"):
+                ask = raw_input('overwrite (y/n)? ')
+
+            if ask == "y":
+                print 'overwrite:',dstfile
+                substitute_file(srcfile, dstfile, filetype)
+
+            if ask == "n":
+                print 'stop overwrite::',dstfile
+                sys.exit(0)
+
+        else:
+            print 'write: from',srcfile
+            print '       into',dstfile
+            substitute_file(srcfile, dstfile, filetype)
+
+    else:
+        print 'error:',srcfile,'does not exist'
+        sys.exit(1)
+
+    return;
+
+
+def convert_file(file, plasma_src, prefix, mode):
+    srcpath = os.path.abspath(plasma_src)
+    dstpath = os.path.join(os.path.abspath(prefix),'')
+
+    filename = os.path.basename(file)
+    filetype = file[:- len(filename)-1]
+
+    srcfilepath = os.path.join(srcpath,file)
+    dstfilepath = os.path.join(dstpath,filetype)
+
+    if filetype == 'core_blas':
+        # coreblas
+        dstpath_core = os.path.join(dstpath, 'coreblas/compute')
+        dstfilepath_core = os.path.join(dstpath_core, filename)
+        change_file(srcfilepath,      dstfilepath_core, 'coreblas', mode)
+        change_file(dstfilepath_core, dstfilepath_core, 'all_end',  True)
+
+    elif filetype == 'core_blas-qwrapper':
+        
+        # coreblas path
+        dstpath_core = os.path.join(dstpath, 'coreblas/compute')
+        dstfilepath_core = os.path.join(dstpath_core, filename)
+
+        if filename == 'qwrapper_zgetf2_nopiv.c'  or \
+           filename == 'qwrapper_zpemv.c'         or \
+           filename == 'qwrapper_zparfb.c':
+            print 'CODELET:', filename, 'do not need to be generated'
+
+        else:
+            # codelet for quark
+            filename = filename.replace('qwrapper', 'codelet')
+            dstpath_quark  = os.path.join(dstpath, 'runtime/quark/codelets')
+            dstfilepath_quark  = os.path.join(dstpath_quark, filename)
+            change_file(srcfilepath, dstfilepath_quark, 'codelet_quark', mode)
+
+            # codelet for starpu
+            filename = filename.replace('core', 'codelet')
+            dstpath_starpu = os.path.join(dstpath, 'runtime/starpu/codelets')
+            dstfilepath_starpu = os.path.join(dstpath_starpu, filename)
+            change_file(dstfilepath_quark, dstfilepath_starpu, 'codelet_starpu', mode)
+
+            # codelet for starpu with WS
+            if filename == 'codelet_zgelqt.c' or \
+               filename == 'codelet_zgeqrt.c' or \
+               filename == 'codelet_ztslqt.c' or \
+               filename == 'codelet_ztsmlq.c' or \
+               filename == 'codelet_ztsmqr.c' or \
+               filename == 'codelet_ztsqrt.c' or \
+               filename == 'codelet_ztstrf.c' or \
+               filename == 'codelet_zttlqt.c' or \
+               filename == 'codelet_zttmlq.c' or \
+               filename == 'codelet_zttmqr.c' or \
+               filename == 'codelet_zttqrt.c' or \
+               filename == 'codelet_zunmlq.c' or \
+               filename == 'codelet_zunmqr.c':
+                change_file(dstfilepath_starpu, dstfilepath_starpu, 'codelet_starpu_ws', True)
+
+            # codelet for starpu with cuda
+            if filename == 'codelet_zgemm.c'  or \
+               filename == 'codelet_zhemm.c'  or \
+               filename == 'codelet_zherk.c'  or \
+               filename == 'codelet_zher2k.c' or \
+               filename == 'codelet_zsymm.c'  or \
+               filename == 'codelet_zsyrk.c'  or \
+               filename == 'codelet_zsyr2k.c' or \
+               filename == 'codelet_ztrsm.c'  or \
+               filename == 'codelet_ztrmm.c'  or \
+               filename == 'codelet_zlauum.c' or \
+               filename == 'codelet_ztrtri.c' or \
+               filename == 'codelet_zpotrf.c':
+                change_file(dstfilepath_starpu, dstfilepath_starpu, 'codelet_starpu_cuda', True)
+
+            change_file(dstfilepath_quark,  dstfilepath_quark,  'all_end', True)
+            change_file(dstfilepath_starpu, dstfilepath_starpu, 'all_end', True)
+
+    elif filetype == 'compute':
+        # drivers (2 treatments is necessary)
+        dstfilepath = os.path.join(dstfilepath,filename)
+        change_file(srcfilepath, dstfilepath, 'all_compute', mode)
+
+        if filename[0:2] == 'pz':
+            change_file(dstfilepath, dstfilepath, 'pcompute',    True)
+
+            # specific transformation
+            if filename == 'pzgebrd_tb2bd.c':
+                change_file(dstfilepath, dstfilepath, filename,  True)
+            if filename == 'pzgetrf_reclap.c':
+                change_file(dstfilepath, dstfilepath, filename,  True)
+            if filename == 'pzgelqfrh.c':
+                change_file(dstfilepath, dstfilepath, filename,  True)
+            if filename == 'pzgeqrfrh.c':
+                change_file(dstfilepath, dstfilepath, filename,  True)
+            if filename == 'pzunglq.c':
+                change_file(dstfilepath, dstfilepath, filename,  True)
+            if filename == 'pzunglqrh.c':
+                change_file(dstfilepath, dstfilepath, filename,  True)
+            if filename == 'pzungqr.c':
+                change_file(dstfilepath, dstfilepath, filename,  True)
+            if filename == 'pzungqrrh.c':
+                change_file(dstfilepath, dstfilepath, filename,  True)
+            if filename == 'pzunmlqrh.c':
+                change_file(dstfilepath, dstfilepath, filename,  True)
+            if filename == 'pzunmqrrh.c':
+                change_file(dstfilepath, dstfilepath, filename,  True)
+
+            # specific transformation to add workspace
+            if filename == 'pzgelqf.c'        or \
+               filename == 'pzgelqfrh.c'      or \
+               filename == 'pzgeqrf.c'        or \
+               filename == 'pzgeqrfrh.c'      or \
+               filename == 'pzgetmi2.c'       or \
+               filename == 'pzgetrf_incpiv.c' or \
+               filename == 'pzhetrd_hb2st.c'  or \
+               filename == 'pzlange.c'        or \
+               filename == 'pzlanhe.c'        or \
+               filename == 'pzlansy.c'        or \
+               filename == 'pzpack.c'         or \
+               filename == 'pzshift.c'        or \
+               filename == 'pzunglq.c'        or \
+               filename == 'pzunglqrh.c'      or \
+               filename == 'pzungqr.c'        or \
+               filename == 'pzungqrrh.c'      or \
+               filename == 'pzunmlq.c'        or \
+               filename == 'pzunmlqrh.c'      or \
+               filename == 'pzunmqr_blgtrd.c' or \
+               filename == 'pzunmqr.c'        or \
+               filename == 'pzunmqrrh.c':
+                # codelet for starpu
+                change_file(dstfilepath, dstfilepath, 'pcompute_ws', True)
+
+        else:
+            change_file(dstfilepath, dstfilepath, 'compute', True)
+
+        change_file(dstfilepath, dstfilepath, 'all_end', True)
+
+    elif filetype == 'include':
+        if filename == 'core_zblas.h' or filename == 'core_zcblas.h':
+            # include for coreblas
+            filetype = 'include_coreblas'
+            dstfilename = filename.replace('core_', 'coreblas_')
+            dstfilename = dstfilename.replace('blas.h', '.h')
+            dstfilepath = os.path.join(dstpath,'coreblas/include')
+            dstfilepath = os.path.join(dstfilepath,dstfilename)
+            change_file(srcfilepath, dstfilepath, filetype, mode)
+            change_file(dstfilepath, dstfilepath, 'all_end', True)
+
+            # include for runtime (insert_task)
+            filetype = 'include_runtime'
+            dstfilepath = os.path.join(dstpath,'include')
+            newfile     = re.sub('core', 'runtime', filename)
+            newfile     = re.sub('blas', '',        newfile)
+            dstfilepath = os.path.join(dstfilepath,newfile)
+            change_file(srcfilepath, dstfilepath, filetype, mode)
+            change_file(dstfilepath, dstfilepath, 'all_end', True)
+
+            # include quark_blas
+            filetype = 'include_quarkblas'
+            dstfilepath = os.path.join(dstpath,'runtime/quark/include')
+            newfile     = re.sub('core', 'quark', filename)
+            dstfilepath = os.path.join(dstfilepath,newfile)
+            change_file(srcfilepath, dstfilepath, filetype, mode)
+            change_file(dstfilepath, dstfilepath, 'all_end', True)
+
+        elif filename == 'plasma_z.h' or filename == 'plasma_zc.h':
+            # include for drivers
+            filetype = 'include_morse'
+            dstfilepath = os.path.join(dstpath,'include')
+            newfile     = re.sub('plasma', 'morse', filename)
+            dstfilepath = os.path.join(dstfilepath,newfile)
+            change_file(srcfilepath, dstfilepath, filetype, mode)
+            change_file(dstfilepath, dstfilepath, 'all_end', True)
+
+        else:
+            print '% >>>>>>>>>>>>>>>>>>>>>>>>>>>'
+            print '% What do you think you do...'
+            print '% <<<<<<<<<<<<<<<<<<<<<<<<<<<'
+            sys.exit(1)
+
+    elif filetype == 'control':
+        newfile     = re.sub('plasma', 'morse', filename)
+        dstfilepath = os.path.join(dstfilepath,newfile)
+        change_file(srcfilepath, dstfilepath, filetype, mode)
+        change_file(dstfilepath, dstfilepath, 'all_end', True)
+
+    else:
+        # others files (timing, testing...)
+        dstfilepath = os.path.join(dstfilepath,filename)
+        change_file(srcfilepath, dstfilepath, filetype, mode)
+        change_file(dstfilepath, dstfilepath, 'all_end', True)
+
+    return;
diff --git a/plasma-conversion/fileCopy.py b/plasma-conversion/fileCopy.py
new file mode 100644
index 0000000000000000000000000000000000000000..f57a1bbe52683d9f37583d96e469fccca1922664
--- /dev/null
+++ b/plasma-conversion/fileCopy.py
@@ -0,0 +1,120 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+###
+#
+# -- Inria
+# -- (C) Copyright 2012
+#
+# This software is a computer program whose purpose is to process
+# Matrices Over Runtime Systems @ Exascale (MORSE). More information
+# can be found on the following website: http://www.inria.fr/en/teams/morse.
+# 
+# This software is governed by the CeCILL-C license under French law and
+# abiding by the rules of distribution of free software.  You can  use, 
+# modify and/ or redistribute the software under the terms of the CeCILL-C
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# "http://www.cecill.info". 
+# 
+# As a counterpart to the access to the source code and  rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty  and the software's author,  the holder of the
+# economic rights,  and the successive licensors  have only  limited
+# liability. 
+# 
+# In this respect, the user's attention is drawn to the risks associated
+# with loading,  using,  modifying and/or developing or reproducing the
+# software by the user in light of its specific status of free software,
+# that may mean  that it is complicated to manipulate,  and  that  also
+# therefore means  that it is reserved for developers  and  experienced
+# professionals having in-depth computer knowledge. Users are therefore
+# encouraged to load and test the software's suitability as regards their
+# requirements in conditions enabling the security of their systems and/or 
+# data to be ensured and,  more generally, to use and operate it in the 
+# same conditions as regards security. 
+# 
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-C license and that you accept its terms.
+#
+###
+#
+#  @file fileCopy.py
+#
+#  @project MORSE
+#  MORSE is a software package provided by:
+#     Inria Bordeaux - Sud-Ouest,
+#     Univ. of Tennessee,
+#     King Abdullah Univesity of Science and Technology
+#     Univ. of California Berkeley,
+#     Univ. of Colorado Denver. 
+# 
+#  @version 1.0.0
+#  @author Cedric Castagnede
+#  @author Emmanuel Agullo
+#  @author Mathieu Faverge
+#  @date 13-07-2012
+#   
+###
+
+import sys;
+import os;
+import shutil;
+import string;
+
+
+def copyDirectoryTree(directory, destination, mode):
+    pattern = shutil.ignore_patterns('.svn', '*~', 'plasma-conversion', 'insert-licence')
+    for entry in os.listdir(directory):
+        entryPath = os.path.join(directory, entry)
+        destPath  = os.path.join(destination, entry)
+        if os.path.isdir(entryPath):
+            if entry == '.svn'             or \
+               entry == 'insert-licence'   or \
+               entry == 'plasma-conversion':
+                continue
+            else:
+                if os.path.exists(destPath):
+                    copyDirectoryTree(entryPath, destPath, mode)
+
+                else:
+                    print 'write:',destPath
+                    shutil.copytree(entryPath, destPath, ignore=pattern)
+
+        else:
+            #if not os.path.exists(destPath):
+                if entry == 'plasma_2.6.0.tar.gz':
+                    continue
+                else:
+                    print 'write:',destPath
+                    shutil.copy(entryPath, destination)
+            #else:
+                #print 'not write:',destPath
+                #print 'already exists:',destPath
+                #if mode is True:
+                #    ask = "y"
+
+                #else:
+                #    ask = ""
+
+                #while (ask != "y") and (ask != "n"):
+                #    ask = raw_input('overwrite (y/n)? ')
+
+                #if ask == "y":
+                #    print 'overwrite:',destPath
+                #    shutil.copy(entryPath, destination)
+
+                #if ask == "n":
+                #    print 'stop overwrite:',destPath
+                #    sys.exit(0)
+
+
+def copy_file(srcpath, dstpath, mode):
+
+    if os.path.exists(srcpath) is True:
+        dstpath2  = os.path.join(dstpath, '')
+        copyDirectoryTree(srcpath, dstpath2, mode)
+
+    else:
+        print 'error:',srcpath,'does not exist'
+        sys.exit(1)
+
+    return;
diff --git a/plasma-conversion/generate_morseSrc.py b/plasma-conversion/generate_morseSrc.py
new file mode 100755
index 0000000000000000000000000000000000000000..da1ef83cb1d2e8338b438501b94749c61ca84d1a
--- /dev/null
+++ b/plasma-conversion/generate_morseSrc.py
@@ -0,0 +1,97 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+###
+#
+# -- Inria
+# -- (C) Copyright 2012
+#
+# This software is a computer program whose purpose is to process
+# Matrices Over Runtime Systems @ Exascale (MORSE). More information
+# can be found on the following website: http://www.inria.fr/en/teams/morse.
+# 
+# This software is governed by the CeCILL-C license under French law and
+# abiding by the rules of distribution of free software.  You can  use, 
+# modify and/ or redistribute the software under the terms of the CeCILL-C
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# "http://www.cecill.info". 
+# 
+# As a counterpart to the access to the source code and  rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty  and the software's author,  the holder of the
+# economic rights,  and the successive licensors  have only  limited
+# liability. 
+# 
+# In this respect, the user's attention is drawn to the risks associated
+# with loading,  using,  modifying and/or developing or reproducing the
+# software by the user in light of its specific status of free software,
+# that may mean  that it is complicated to manipulate,  and  that  also
+# therefore means  that it is reserved for developers  and  experienced
+# professionals having in-depth computer knowledge. Users are therefore
+# encouraged to load and test the software's suitability as regards their
+# requirements in conditions enabling the security of their systems and/or 
+# data to be ensured and,  more generally, to use and operate it in the 
+# same conditions as regards security. 
+# 
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-C license and that you accept its terms.
+#
+###
+#
+#  @file generate_morseSrc.py 
+#
+#  @project MORSE
+#  MORSE is a software package provided by:
+#     Inria Bordeaux - Sud-Ouest,
+#     Univ. of Tennessee,
+#     King Abdullah Univesity of Science and Technology
+#     Univ. of California Berkeley,
+#     Univ. of Colorado Denver. 
+# 
+#  @version 1.0.0
+#  @author Cedric Castagnede
+#  @author Emmanuel Agullo
+#  @author Mathieu Faverge
+#  @date 13-07-2012
+#   
+###
+
+import sys;
+import shutil;
+from optparse import OptionParser,OptionGroup;
+
+from fileConversion import *;
+from fileCopy import *;
+
+def main(argv):
+
+    # Create the options parser for detecting options on the command line.
+    parser = OptionParser(usage="Usage: %prog [options]");
+    group = OptionGroup(parser,"Printing Options","These options control generate_morseSrc.py.");
+    group.add_option("-y","--force"     , help=': Force overwrite all files'             , action='store_true', dest='force'    , default=False);
+    group.add_option("-o","--prefix"    , help=': install files in PREFIX.'              , action='store'     , dest='prefix'   , type='string', default=False);
+    group.add_option("-p","--plasma-dir", help=': Specify the top directory of PLASMA.'  , action='store'     , dest='pdir'     , type='string', default=False);
+    group.add_option("-m","--morse-dir" , help=': Specify the top directory of MORSE.'   , action='store'     , dest='mdir'     , type='string', default=False);
+    group.add_option("-f","--file"      , help=': Specify a file(s) on which to operate.', action='store'     , dest='flist'    , type='string', default=False);
+    parser.add_option_group(group);
+    (options, args) = parser.parse_args();
+
+    # Create files from PLASMA
+    if options.prefix and options.pdir and options.flist:
+        print '\n#####################'
+        print '\nCONVERT PLASMA FILES '
+        print '\n#####################'
+        for file in options.flist.split():
+            convert_file(file, options.pdir, options.prefix, options.force)
+
+    # Copy file from MORSE
+    if options.prefix and options.mdir:
+        print '\n#####################'
+        print '\nCOPY NEEDED SVN MORSE'
+        print '\n#####################'
+        copy_file(options.mdir, options.prefix, options.force)
+
+    # Exit
+    return 0
+
+if "__main__" == __name__:
+    sys.exit(main(sys.argv))
diff --git a/plasma-conversion/insert-licence/chameleon_c.licence b/plasma-conversion/insert-licence/chameleon_c.licence
new file mode 100644
index 0000000000000000000000000000000000000000..d5bc10c4c5605cd16d1c3166c4627b4b52fccfb0
--- /dev/null
+++ b/plasma-conversion/insert-licence/chameleon_c.licence
@@ -0,0 +1,10 @@
+/**
+ *
+ * @copyright (c) 2009-2015 The University of Tennessee and The University
+ *                          of Tennessee Research Foundation.
+ *                          All rights reserved.
+ * @copyright (c) 2012-2016 Inria. All rights reserved.
+ * @copyright (c) 2012-2015 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
+ *
+ **/
+
diff --git a/plasma-conversion/insert-licence/chameleon_f.licence b/plasma-conversion/insert-licence/chameleon_f.licence
new file mode 100644
index 0000000000000000000000000000000000000000..7d0c75c31ebd7e4690c1f2979e47e5fa266b5835
--- /dev/null
+++ b/plasma-conversion/insert-licence/chameleon_f.licence
@@ -0,0 +1,10 @@
+!!!
+!
+! @copyright (c) 2009-2015 The University of Tennessee and The University
+!                          of Tennessee Research Foundation.
+!                          All rights reserved.
+! @copyright (c) 2012-2016 Inria. All rights reserved.
+! @copyright (c) 2012-2015 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
+!
+!!!
+
diff --git a/plasma-conversion/insert-licence/insert-licence-chameleon.sh b/plasma-conversion/insert-licence/insert-licence-chameleon.sh
new file mode 100755
index 0000000000000000000000000000000000000000..baec98fa0934fba85fb6634e58b9ac36b3c10825
--- /dev/null
+++ b/plasma-conversion/insert-licence/insert-licence-chameleon.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+###
+#
+# -- Inria
+# -- (C) Copyright 2016
+#
+# This software is a computer program whose purpose is to process
+# Matrices Over Runtime Systems @ Exascale (MORSE). More information
+# can be found on the following website: http://www.inria.fr/en/teams/morse.
+#
+# This software is governed by the CeCILL-C license under French law and
+# abiding by the rules of distribution of free software.  You can  use,
+# modify and/ or redistribute the software under the terms of the CeCILL-C
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# "http://www.cecill.info".
+#
+# As a counterpart to the access to the source code and  rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty  and the software's author,  the holder of the
+# economic rights,  and the successive licensors  have only  limited
+# liability.
+#
+# In this respect, the user's attention is drawn to the risks associated
+# with loading,  using,  modifying and/or developing or reproducing the
+# software by the user in light of its specific status of free software,
+# that may mean  that it is complicated to manipulate,  and  that  also
+# therefore means  that it is reserved for developers  and  experienced
+# professionals having in-depth computer knowledge. Users are therefore
+# encouraged to load and test the software's suitability as regards their
+# requirements in conditions enabling the security of their systems and/or
+# data to be ensured and,  more generally, to use and operate it in the
+# same conditions as regards security.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-C license and that you accept its terms.
+#
+###
+#
+#  @file insert-licence.sh
+#
+#  @project MORSE
+#  MORSE is a software package provided by:
+#     Inria Bordeaux - Sud-Ouest,
+#     Univ. of Tennessee,
+#     King Abdullah Univesity of Science and Technology
+#     Univ. of California Berkeley,
+#     Univ. of Colorado Denver.
+#
+#  @version 1.0.0
+#  @author Cedric Castagnede
+#  @author Emmanuel Agullo
+#  @author Mathieu Faverge
+#  @author Florent Pruvost
+#  @date 13-07-2012
+#
+###
+for i in $(find . -name "*.c" -or -name "*.h" -not -path "*svn*" -not -name "morse_fortran.h")
+do
+  cat $(dirname $0)/chameleon_c.licence > $(dirname $0)/buffer.tmp
+  cat $i >> $(dirname $0)/buffer.tmp
+  cat $(dirname $0)/buffer.tmp > $i
+  rm $(dirname $0)/buffer.tmp
+done
+
+for i in $(find . -name "*.f" -or -name "*.F" -or -name "*.f77" -or -name "*.F77" -or -name "*.f90" -or -name "*.F90" -or -name "morse_fortran.h")
+do
+  cat $(dirname $0)/chameleon_f.licence > $(dirname $0)/buffer.tmp
+  cat $i >> $(dirname $0)/buffer.tmp
+  cat $(dirname $0)/buffer.tmp > $i
+  rm $(dirname $0)/buffer.tmp
+done
diff --git a/plasma-conversion/rulesSubstitutions.py b/plasma-conversion/rulesSubstitutions.py
new file mode 100644
index 0000000000000000000000000000000000000000..894cad5007fd733b797c46d463fdfa4195e5da04
--- /dev/null
+++ b/plasma-conversion/rulesSubstitutions.py
@@ -0,0 +1,706 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+###
+#
+# -- Inria
+# -- (C) Copyright 2012
+#
+# This software is a computer program whose purpose is to process
+# Matrices Over Runtime Systems @ Exascale (MORSE). More information
+# can be found on the following website: http://www.inria.fr/en/teams/morse.
+# 
+# This software is governed by the CeCILL-C license under French law and
+# abiding by the rules of distribution of free software.  You can  use, 
+# modify and/ or redistribute the software under the terms of the CeCILL-C
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# "http://www.cecill.info". 
+# 
+# As a counterpart to the access to the source code and  rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty  and the software's author,  the holder of the
+# economic rights,  and the successive licensors  have only  limited
+# liability. 
+# 
+# In this respect, the user's attention is drawn to the risks associated
+# with loading,  using,  modifying and/or developing or reproducing the
+# software by the user in light of its specific status of free software,
+# that may mean  that it is complicated to manipulate,  and  that  also
+# therefore means  that it is reserved for developers  and  experienced
+# professionals having in-depth computer knowledge. Users are therefore
+# encouraged to load and test the software's suitability as regards their
+# requirements in conditions enabling the security of their systems and/or 
+# data to be ensured and,  more generally, to use and operate it in the 
+# same conditions as regards security. 
+# 
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-C license and that you accept its terms.
+#
+###
+#
+#  @file rulesSubstitutions.py
+#
+#  @project MORSE
+#  MORSE is a software package provided by:
+#     Inria Bordeaux - Sud-Ouest,
+#     Univ. of Tennessee,
+#     King Abdullah Univesity of Science and Technology
+#     Univ. of California Berkeley,
+#     Univ. of Colorado Denver. 
+# 
+#  @version 1.0.0
+#  @author Cedric Castagnede
+#  @author Emmanuel Agullo
+#  @author Mathieu Faverge
+#  @date 13-07-2012
+#   
+###
+
+subs = {
+  # --------------------------------------------------------
+  # replacements applied to ALL files first.
+  'all_begin' : [
+    ( 'u', None, None ),
+  ],
+
+  # ------------------------------------------------------------
+  # replacements applied to compute files.
+  'all_compute' : [
+    # Get information in static function to allocate workspace
+    ( 'r', '#include([\s\S]*)plasma_private_alloc\(([^,]*),([\s\S]*?),([^)]*)\)',         '//WS_ALLOC : \\3\n#include\\1'                                ),
+    # end get
+
+    ( 'u', 'plasma_static_call_([\w]*)\(([\s\\\]*)plasma_([\w]*),([^;]*);',               'morse_\\3(,\\4;'                                              ),
+    ( 'u', 'plasma_dynamic_call_([\w]*)\(([\s\\\]*)plasma_([\w]*),([^;]*);',              'morse_\\3(,\\4;'                                              ),
+    ( 'u', 'plasma_parallel_call_([\w]*)\(([\s\\\]*)plasma_([\w]*),([^;]*);',             'morse_\\3(,\\4;'                                              ),
+    ( 'u', 'plasma_static_call_([\w]*)\(([\s\\\]*)plasma_([\w]*),([\s\S]*?)request\)',    'morse_\\3(,\\4)'                                              ),
+    ( 'u', 'plasma_dynamic_call_([\w]*)\(([\s\\\]*)plasma_([\w]*),([\s\S]*?)request\)',   'morse_\\3(,\\4)'                                              ),
+    ( 'u', 'plasma_parallel_call_([\w]*)\(([\s\\\]*)plasma_([\w]*),([\s\S]*?)request\)',  'morse_\\3(,\\4)'                                              ),
+    # Dirty replacement to put the correct call of 'morse_pz***` by removing all types
+    # The 8 first lines are called n times more to be sure to change all `plasma_desc_mat_free(&desc` to `RUNTIME_desc_getoncpu(`
+    ( 'r', 'morse_p([\w]*)\(([^;]*),([\s\w]*)PLASMA_enum([ \w\*]*),([^;]*);',             'morse_p\\1(\\2,\\5;'                                          ),
+    ( 'r', 'morse_p([\w]*)\(([^;]*),([\s\w]*)PLASMA_desc([ \w\*]*),([^;]*);',             'morse_p\\1(\\2,\\5;'                                          ),
+    ( 'r', 'morse_p([\w]*)\(([^;]*),([\s\w]*)PLASMA_Complex64_t([ \w\*]*),([^;]*);',      'morse_p\\1(\\2,\\5;'                                          ),
+    ( 'r', 'morse_p([\w]*)\(([^;]*),([\s\w]*)PLASMA_sequence([ \w\*]*),([^;]*);',         'morse_p\\1(\\2,\\5;'                                          ),
+    ( 'r', 'morse_p([\w]*)\(([^;]*),([\s\w]*)PLASMA_request([ \w\*]*),([^;]*);',          'morse_p\\1(\\2,\\5;'                                          ),
+    ( 'r', 'morse_p([\w]*)\(([^;]*),([\s\w]*)int([ \w\*]*),([^;]*);',                     'morse_p\\1(\\2,\\5;'                                          ),
+    ( 'r', 'morse_p([\w]*)\(([^;]*),([\s\w]*)float([ \w\*]*),([^;]*);',                   'morse_p\\1(\\2,\\5;'                                          ),
+    ( 'r', 'morse_p([\w]*)\(([^;]*),([\s\w]*)double([ \w\*]*),([^;]*);',                  'morse_p\\1(\\2,\\5;'                                          ),
+
+    ( 'u', 'morse_p([\w]*)\(([, ]*)',                                                     'morse_p\\1('                                                  ),
+  ],
+  #
+  #
+  'compute' : [
+    # Check the 2 next lines when plasma const will be right
+    ( 'u', 'OUTOFPLACE([^}]+)plasma_zooptile2lap\(([\s]*)([^,]+),([^}]+)plasma_dynamic_sync\(\);([\s]*)plasma_desc_mat_free([^}]+)}',
+           'OUTOFPLACE\\1morse_zooptile2lap(\\3,\\4RUNTIME_barrier(morse);\\5RUNTIME_desc_getoncpu(&\\3);\\5plasma_desc_mat_free\\6}'                    ),
+    ( 'u', 'OUTOFPLACE([^}]+)RUNTIME_desc_getoncpu([^;]+);([\s]*)([^}]+)}([\s\S]*)_Tile\(([\s\S]*)plasma_dynamic_sync\(\);([\s]*)status = sequence->status',
+           'OUTOFPLACE\\1RUNTIME_desc_getoncpu\\2;\\4}\\5_Tile(\\6RUNTIME_barrier(morse);\\7\\4\\7status = sequence->status'                             ),
+    # Dirty replacement for MORSE_z*_Tile to put RUNTIME_desc_getoncpu
+    # The two first lines are called 10 times more to be sure to change all `plasma_desc_mat_free(&desc` to `RUNTIME_desc_getoncpu(`
+    ( 'r', '_Tile\(([\s\S]*)RUNTIME_barrier\(morse\);([^}]*)plasma_desc_mat_free\(&desc([^}]*)status = sequence->status',
+           '_Tile(\\1RUNTIME_barrier(morse);\\2RUNTIME_desc_getoncpu(\\3status = sequence->status'                                                       ),
+
+    # Specific change for zplghe.c, zplgsy.c, zplrnt.c
+    # TODO: it works because it is the last call in the function
+    #       we need to find better delimiters
+    ( 'u', '_zplghe\(([\s\S]*)\n([ \t]*)plasma_ziptile2lap\(([^;]*);',
+           '_zplghe(\\1\n\\2RUNTIME_barrier(morse);\n\\2morse_zooptile2lap(\\3;' ),
+    ( 'u', '_zplgsy\(([\s\S]*)\n([ \t]*)plasma_ziptile2lap\(([^;]*);',
+           '_zplgsy(\\1\n\\2RUNTIME_barrier(morse);\n\\2morse_zooptile2lap(\\3;' ),
+    ( 'u', '_zplrnt\(([\s\S]*)\n([ \t]*)plasma_ziptile2lap\(([^;]*);',
+           '_zplrnt(\\1\n\\2RUNTIME_barrier(morse);\n\\2morse_zooptile2lap(\\3;' ),
+    # end specific
+
+    # Remove INPLACE / OUTOFPLACE
+    ( 'u', '\n([^\n]*)OUTOFPLACE([^\n]*)\n([\s\S]*?)\n([^\n]*)else([^\n]*)\n([\s\S]*?)\n([^\n]*)}([^\n]*)\n',
+           '\n/*\\1OUTOFPLACE\\2*/\n\\3\n/*\\4else\\5*/\n\\6\n/*\\7}\\8*/\n'                                                                             ),
+    ( 'r', '\n([^\n]*?)OUTOFPLACE([^}]*?)}([\s]*)else([^}]*?)\n([ ])([^\n]*?)\n([^}]*?)}',
+           '\n\\1OUTOFPLACE\\2} else\\4\n/*\\5\\6*/\n\\7}'                                                                                               ),
+    ( 'u', '\n([ ]+)([\s]*)plasma_ziptile2lap([^;]*);([ \t]*)\n',                         '\n/*\\1\\2plasma_ziptile2lap\\3;\\4*/\n'                      ),
+    ( 'u', '\n([ ]+)([\s]*)plasma_ziplap2tile([^;]*);([ \t]*)\n',                         '\n/*\\1\\2plasma_ziplap2tile\\3;\\4*/\n'                      ),
+    # end remove
+
+    # Change plasma_desc_init into morse_zdesc_alloc
+    ( 'u', 'desc([\w]*)([ \t]*)=([ \t]*)plasma_desc_init\(([^,]*),([^;]*);([\s]*)([^;]*);', 'morse_zdesc_alloc(desc\\1,\\5;'                             ),
+    ( 'u', 'morse_zdesc_alloc\(([^;]*),([\w\s]*)\*([\w\s]*),([^;]*);',                      'morse_zdesc_alloc(\\1,\\4;'                                 ),
+    ( 'u', 'morse_zdesc_alloc\(([^;]*)\n([ \t]*)([^;]*);',                                  'morse_zdesc_alloc(\\1 \\3;'                                 ),
+    ( 'u', 'morse_zdesc_alloc\(desc([\w]*)([^;]*)\);',                                   'morse_zdesc_alloc(desc\\1\\2, morse_desc_mat_free(&desc\\1));' ),
+    # end chhange
+
+    # Remove desc in Async
+    ( 'u', 'desc([\w]*)\.d',                                                              '\\1->d'                                                       ),
+    ( 'u', 'desc([\w]*)\.i',                                                              '\\1->i'                                                       ),
+    ( 'u', 'desc([\w]*)\.j',                                                              '\\1->j'                                                       ),
+    ( 'u', 'desc([\w]*)\.l',                                                              '\\1->l'                                                       ),
+    ( 'u', 'desc([\w]*)\.m',                                                              '\\1->m'                                                       ),
+    ( 'u', 'desc([\w]*)\.n',                                                              '\\1->n'                                                       ),
+    ( 'r', '_Tile_Async\(([\s\S]*)\n([ \t]*)PLASMA_desc([ \t]*)([\w]*);([ \t]*)\n([\s\S]*)\n}\n',
+           '_Tile_Async(\\1\n\\6\n}\n'                                                                                                                   ),
+    ( 'r', '_Tile_Async\(([\s\S]*)\n([ \t]*)desc([\w]*)([ \t]*)=([ \t]*)\*\\3;([ \t]*)\n([\s\S]*)\n}\n',
+           '_Tile_Async(\\1\n\\7\n}\n'                                                                                                                   ),
+    ( 'r', '_Tile_Async\(([\s\S]*)\n([ \t]*)}([ \t]*)else([ \t]*){([\s]*)}([ \t]*)\n([\s\S]*)\n}\n' ,
+           '_Tile_Async(\\1\n\\2}\n\\7\n}\n'                                                                                                             ),
+    ( 'r', '_Tile_Async\(([\s\S]*)morse_p([\w]*)\(([^;]*)desc([a-zA-Z0-9]+)([^;]*);([\s\S]*)\n}\n' ,
+           '_Tile_Async(\\1morse_p\\2(\\3\\4\\5;\\6\n}\n'                                                                                                ),
+    # end remove
+
+    # Patch for morse_desc_submatrix (this will not work with 2-sided and LU inversion)
+    ( 'r', '_Tile_Async\(([\s\S]*)^([\s]*)morse_p([\w]*)\(([^;]*)plasma_desc_submatrix\(([\s]*)([a-zA-Z0-9]+),([\s\S]*)\),([^;]*);',
+           '_Tile_Async(\\1\\2sub\\6 = morse_desc_submatrix(\\5\\6,\\7);\n\\2morse_p\\3(\\4sub\\6,\\8;\n\\2free(sub\\6);'                                ),
+    ( 'r', '_Tile_Async\(([^)]*)\)([\s]*){([\s\S]*)free\(sub([\w]*)\)',
+           '_Tile_Async(\\1)\\2{\n\tMORSE_desc_t *sub\\4;\\3FLAGFREE(sub\\4)'                                                                            ),
+    ( 'r', '_Tile_Async\(([^)]*)\)([\s]*){([\s\S]*)MORSE_desc_t \*sub([\w]*);([\s\S]*)\n^([\s]*)MORSE_desc_t \*sub\\4;',
+           '_Tile_Async(\\1)\\2{\\3MORSE_desc_t *sub\\4;\\5'                                                                                             ),
+    ( 'u', 'FLAGFREE',                                                                    'free'                                                         ),
+    # end patch
+
+    ( 'u', 'PLASMA_Dealloc_Handle_Tile',                                                  'MORSE_Dealloc_Workspace'                                      ),
+    ( 'u', 'plasma_dynamic_sync\(\)',                                                     'RUNTIME_barrier(morse)'                                       ),
+    ( 'u', 'QUARK_Barrier\(plasma->quark\)',                                              'RUNTIME_barrier(morse)'                                       ),
+    ( 'u', 'PLASMA_desc',                                                                 'MORSE_desc_t'                                                 ),
+    ( 'u', 'plasma_context_t',                                                            'MORSE_context_t'                                              ),
+    ( 'u', 'PLASMA_sequence',                                                             'MORSE_sequence_t'                                             ),
+    ( 'u', 'PLASMA_request',                                                              'MORSE_request_t'                                              ),
+
+    ( 'u', 'PLASMA',                                                                      'MORSE'                                                        ),
+    ( 'u', 'Plasma',                                                                      'Morse'                                                        ),
+    ( 'u', 'plasma',                                                                      'morse'                                                        ),
+
+    # Fix for zgels et zgelqs
+    ( 'u', 'MORSE_zgels_Tile_Async([\s\S]*)sub([\w]*) = ([\s\S]*?)morse_pztile_zero([\s\S]*?)free([^;]*);',
+           'MORSE_zgels_Tile_Async\\1/* sub\\2 = \\3morse_pztile_zero\\4free\\5; */'                                                                     ),
+    ( 'u', 'MORSE_zgelqs_Tile_Async([\s\S]*)sub([\w]*) = ([\s\S]*?)morse_pztile_zero([\s\S]*?)free([^;]*);',
+           'MORSE_zgelqs_Tile_Async\\1/* sub\\2 = \\3morse_pztile_zero\\4free\\5; */'                                                                    ),
+
+  ],
+
+  # ------------------------------------------------------------
+  # replacements applied to pcompute files.
+  'pcompute' : [
+    ( 'u', '#if 0([\s\S]*?)#endif',                                                       ''                                                             ),
+    ( 'u', 'plasma_([\w]*)_quark\(',                                                      'morse_\\1('                                                   ),
+    ( 'u', '\*\*/([\s]*?)void([\s]*?)plasma_([\w]*?)\(([\s\S]*)}([\s]*?)/\*\*',           '**/\\1\n/**'                                                  ),
+    ( 'u', 'static scheduling([\s\S]*)dynamic scheduling',                                'dynamic scheduling'                                           ),
+
+    ( 'u', 'Quark_Task_Flags task_flags([\w]*) = Quark_Task_Flags_Initializer;',          'MORSE_option_t options\\1;'                                   ),
+    ( 'u', 'QUARK_Task_Flag_Set\(([\s\S]*?)task_flags([\w]*)([\s]*),([^\n]*)\);',         'RUNTIME_options_init(&options\\2, morse, sequence, request);' ),
+    ( 'u', 'plasma->quark, &task_flags([\w]*)',                                           '&options\\1'                                                  ),
+    ( 'u', 'RUNTIME_options_init\(&options([\w]*),([\s\S]*)}',
+           'RUNTIME_options_init(&options\\1,\\2\tRUNTIME_options_finalize(&options\\1, morse);\n}'                                                      ),
+
+    ( 'u', 'plasma_dynamic_sync\(\)',                                                     'RUNTIME_barrier(morse)'                                       ),
+    ( 'u', 'QUARK_Barrier\(plasma->quark\)',                                              'RUNTIME_barrier(morse)'                                       ),
+
+    ( 'u', 'PLASMA_desc([ \t]*)',                                                         'MORSE_desc_t\\1*'                                             ),
+    ( 'u', 'plasma_context_t',                                                            'MORSE_context_t'                                              ),
+    ( 'u', 'PLASMA_sequence',                                                             'MORSE_sequence_t'                                             ),
+    ( 'u', 'PLASMA_request',                                                              'MORSE_request_t'                                              ),
+
+    ( 'u', 'PLASMA',                                                                      'MORSE'                                                        ),
+    ( 'u', 'QUARK_CORE',                                                                  'MORSE_TASK'                                                   ),
+    ( 'u', 'Plasma',                                                                      'Morse'                                                        ),
+    ( 'u', 'plasma',                                                                      'morse'                                                        ),
+    ( 'u', '_quark',                                                                      ''                                                             ),
+
+    ( 'u', 'MORSE_TASK([\w]*)\(([^;]*),([ \n\t]*)sequence([^;]*);',                       'MORSE_TASK\\1(\\2\\4;'                                        ),
+    ( 'u', 'MORSE_TASK([\w]*)\(([^;]*),([ \n\t]*)request([^;]*);',                        'MORSE_TASK\\1(\\2\\4;'                                        ),
+    ( 'u', '#define([\w\s]*)\(([\w\s]*),([\w\s]*)\)([ \t]*)BLKADDR\(([\S\s]*?),([\S\s]*?),([\S\s]*?),([\S\s]*?)\)\n',
+           '#define\\1(\\2,\\3) \\5, \\7, \\8\n'                                                                                                         ),
+
+    ( 'u', '([\w]*)\.d',                                                                  '\\1->d'                                                       ),
+    ( 'u', '([\w]*)\.i',                                                                  '\\1->i'                                                       ),
+    ( 'u', '([\w]*)\.j',                                                                  '\\1->j'                                                       ),
+    ( 'u', '([\w]*)\.l',                                                                  '\\1->l'                                                       ),
+    ( 'u', '([\w]*)\.m',                                                                  '\\1->m'                                                       ),
+    ( 'u', '([\w]*)\.n',                                                                  '\\1->n'                                                       ),
+  ],
+  #
+  #
+  # specific patch because of dirty source code
+  'pzgebrd_tb2bd.c' : [
+    ( 'u', '#define A\(_m, _n\) \(MORSE_Complex64_t \*\)morse_geteltaddr\(&A, \(_m\), \(_n\), eltsize\)',
+           '#define A(_m,_n) BLKADDR(&dA, MORSE_Complex64_t, _m, _n)'                                                                                    ),
+  ],
+  'pzgetrf_reclap.c' : [
+    ( 'u', '#define BLKLDD\(&dA, k\) \(A\)d.lm',                                          '#define BLKLDD(dA, k) (dA).lm'                                ),
+    ( 'u', 'BLKLDD\(&dA',                                                                 'BLKLDD(dA'                                                    ),
+  ],
+  #
+  #
+  # Need to add specific information - not static implementation
+  'pzgelqfrh.c' : [
+    ( 'u', '#include "common.h"',                                                         '//WS_ALLOC :  A->nb + ib*T->nb\n#include "common.h"'          ),
+  ],
+  'pzgeqrfrh.c' : [
+    ( 'u', '#include "common.h"',                                                         '//WS_ALLOC :  A->nb + ib*T->nb\n#include "common.h"'          ),
+  ],
+  'pzunglq.c': [
+    ( 'u', '#include "common.h"',                                                         '//WS_ALLOC :  ib*T->nb\n#include "common.h"'                  ),
+  ],
+  'pzunglqrh.c': [
+    ( 'u', '#include "common.h"',                                                         '//WS_ALLOC :  ib*T->nb\n#include "common.h"'                  ),
+  ],
+  'pzungqr.c': [
+    ( 'u', '#include "common.h"',                                                         '//WS_ALLOC :  ib*T->nb\n#include "common.h"'                  ),
+  ],
+  'pzungqrrh.c': [
+    ( 'u', '#include "common.h"',                                                         '//WS_ALLOC :  ib*T->nb\n#include "common.h"'                  ),
+  ],
+  'pzunmlqrh.c': [
+    ( 'u', '#include "common.h"',                                                         '//WS_ALLOC :  ib*T->nb\n#include "common.h"'                  ),
+  ],
+  'pzunmqrrh.c': [
+    ( 'u', '#include "common.h"',                                                         '//WS_ALLOC :  ib*T->nb\n#include "common.h"'                  ),
+  ],
+
+  # end specific patch
+
+  # ------------------------------------------------------------
+  # replacements applied to pcompute files - (workspace)
+  'pcompute_ws' : [
+    # Compute the size of the workspace
+    ( 'u', '#include "common.h"',                                     '//WS_ADD : \n#include "common.h"'                                                 ),
+    ( 'u', '//WS_ALLOC : ([^\n]*)\n([\s\S]*?)//WS_ADD : ([^\n]*)\n',  '//ALLOC_WS : \\1\n\\2//WS_ADD : \\3\\1\n'                                         ),
+    ( 'r', '//WS_ALLOC : ([^\n]*)\n([\s\S]*?)//WS_ADD : ([^\n]*)\n',  '//ALLOC_WS : \\1\n\\2//WS_ADD : \\3 +\\1\n'                                       ),
+    # end compute
+    ( 'u', '([\s\S]*?)WS_ADD : ([^\n]*)\n([\s\S]*?)^([\s]*)ib([\s]*)=([\s]*)MORSE_IB([\s]*);',
+           '\\1WS_ADD : \\2\n\\3\\4ib\\5=\\6MORSE_IB\\7;\\4h_work_size  = sizeof(MORSE_Complex64_t)*(\\2 );\\4d_work_size  = 0;\\4RUNTIME_options_ws_alloc( &options, h_work_size, d_work_size );\n' ),
+    ( 'u', 'RUNTIME_options_finalize\(&options, morse\);',            'RUNTIME_options_ws_free(&options);\n\tRUNTIME_options_finalize(&options, morse);' ),
+    ( 'u', 'MORSE_option_t options;',                                 'MORSE_option_t options;\n\tsize_t h_work_size, d_work_size;'                      ),
+  ],
+
+  # ------------------------------------------------------------
+  # replacements applied to coreblas files.
+  'coreblas' : [
+    ( 'u', '#include "common.h"',                                                         '#include "coreblas.h"'                                        ),
+    ( 'u', '#include "quark.h"',                                                          ''                                                             ),
+    ( 'u', '#if defined\(PLASMA_HAVE_WEAK\)([\s\S]*?)#endif',                             ''                                                             ),
+    ( 'u', 'int([\s]*)QUARK_CORE_([\w]*)\(([^)]*)\)([\s]*){([\s\S]*?)\n}',                ''                                                             ),
+    ( 'u', 'void([\s]*)QUARK_CORE_([\w]*)\(([^)]*)\)([\s]*){([\s\S]*?)\n}',               ''                                                             ),
+    ( 'u', 'void([\s]*)CORE([\w]*)_quark\(([^)]*)\)([\s]*){([\s\S]*?)\n}',                ''                                                             ),
+    ( 'u', 'BLKADDR\(([ ]*)([\w]*),([^\n]*)',                                             'BLKADDR(&\\2,\\3'                                             ),
+    ( 'u', 'BLKLDD\(([ ]*)([\w]*)([^\n]*)',                                               'BLKLDD(&\\2\\3'                                               ),
+
+    ( 'u', 'PLASMA_desc',                                                                 'MORSE_desc_t'                                                 ),
+    ( 'u', 'PLASMA_Complex64_t',                                                          'MORSE_Complex64_t'                                            ),
+    ( 'u', 'PLASMA_Complex32_t',                                                          'MORSE_Complex32_t'                                            ),
+    ( 'u', 'PLASMA_enum',                                                                 'MORSE_enum'                                                   ),
+    ( 'u', 'PLASMA_CORE',                                                                 'MORSE_CORE'                                                   ),
+    ( 'u', 'PLASMA_SUCCESS',                                                              'MORSE_SUCCESS'                                                ),
+    ( 'u', 'PLASMA_ERR_NOT_SUPPORTED',                                                    'MORSE_ERR_NOT_SUPPORTED'                                      ),
+    ( 'u', 'Plasma',                                                                      'Morse'                                                        ),
+    ( 'u', 'plasma',                                                                      'morse'                                                        ),
+
+    ( 'u', '/([\s\\*]*)/\n\n',                                                            ''                                                             ),
+  ],
+
+  # ------------------------------------------------------------
+  # replacements applied to codelet_quark files.
+  'codelet_quark' : [
+    ( 'u', '#include "common.h"',                                                         '#include "morse_quark.h"'                                     ),
+    ( 'u', '#if defined\(PLASMA_HAVE_WEAK\)([\s\S]*?)#endif',                             ''                                                             ),
+
+    ( 'u', '\n([\s\w]*)void([\s]*)CORE_([a-zA-Z0-9]*)\(([^)]*)\)([\s]*){([\s\S]*?)\n}',   ''                                                             ),
+    ( 'u', '\n([\s\w]*)int([\s]*)CORE_([a-zA-Z0-9]*)\(([^)]*)\)([\s]*){([\s\S]*?)\n}',    ''                                                             ),
+    ( 'u', '\n([\s\w]*)void([\s]*)CORE_([\w]*)_([^q])([a-zA-Z0-9]*)\(([^)]*)\)([\s]*){([\s\S]*?)\n}', ''                                                 ),
+    ( 'u', '\n([\s\w]*)int([\s]*)CORE_([\w]*)_([^q])([a-zA-Z0-9]*)\(([^)]*)\)([\s]*){([\s\S]*?)\n}',  ''                                                 ),
+    ( 'u', '\n([\s\w]*)void([\s]*)CORE_([a-zA-Z0-9]*)\(([^)]*)\);',                       ''                                                             ),
+    ( 'u', '\n([\s\w]*)int([\s]*)CORE_([a-zA-Z0-9]*)\(([^)]*)\);',                        ''                                                             ),
+    ( 'u', '\n([\s\w]*)void([\s]*)CORE_([\w]*)_([^q])([a-zA-Z0-9]*)\(([^)]*)\);',         ''                                                             ),
+    ( 'u', '\n([\s\w]*)int([\s]*)CORE_([\w]*)_([^q])([a-zA-Z0-9]*)\(([^)]*)\);',          ''                                                             ),
+
+    ( 'u', 'Quark([\s]*)\*quark,([\s]*)Quark_Task_Flags([\s]*)\*task_flags,',             'MORSE_option_t *options,'                                     ),
+    ( 'u', 'plasma_sequence_flush',                                                       'RUNTIME_sequence_flush'                                       ),
+    ( 'u', 'QUARK_Insert_Task\(([ \t\n]*)quark',                                          'QUARK_Insert_Task(\\1options->quark'                          ),
+    ( 'u', 'QUARK_Insert_Task\(([^)]*)task_flags',                                        'QUARK_Insert_Task(\\1options->task_flags'                     ),
+    ( 'u', '&sequence,',                                                                  '&(options->sequence),'                                        ),
+    ( 'u', '&request,',                                                                   '&(options->request),'                                         ),
+
+    ( 'u', '\(([\s\S]*),([\s]*)PLASMA_sequence([^,]*)sequence',                           '(\\1'                                                         ),
+    ( 'u', '\(([\s\S]*),([\s]*)PLASMA_request([^,]*)request',                             '(\\1'                                                         ),
+    ( 'u', 'PLASMA_sequence',                                                             'MORSE_sequence_t'                                             ),
+    ( 'u', 'PLASMA_request',                                                              'MORSE_request_t'                                              ),
+    ( 'u', 'PLASMA_desc',                                                                 'MORSE_desc_t'                                                 ),
+
+    ( 'u', 'static inline \n',                                                            ''                                                             ),
+    ( 'u', 'static \n',                                                                   ''                                                             ),
+
+    ( 'r', 'QUARK_CORE([\w]*)\(([\s\S]*)const ([ \t\w]*)\*([\w]*),' ,                     'QUARK_CORE\\1(\\2\\3*\\4,'                                    ),
+    ( 'r', 'QUARK_CORE([\w]*)\(([\s\S]*)PLASMA_Complex64_t([ \t]*)\*([\w]*),' ,           'QUARK_CORE\\1(\\2MORSE_desc_t *\\4, int \\4m, int \\4n,'      ),
+    ( 'r', 'QUARK_CORE([\w]*)\(([\s\S]*)PLASMA_Complex32_t([ \t]*)\*([\w]*),' ,           'QUARK_CORE\\1(\\2MORSE_desc_t *\\4, int \\4m, int \\4n,'      ),
+    ( 'r', 'QUARK_Insert_Task\(([^;]*)sizeof\(PLASMA_Complex64_t\)\*([\s\S]*?),([\s]*)([\w]*),',
+           'QUARK_Insert_Task(\\1sizeof(MORSE_Complex64_t)*\\2,\\3RTBLKADDR(\\4, MORSE_Complex64_t, \\4m, \\4n),'                                        ),
+    ( 'r', 'QUARK_Insert_Task\(([^;]*)sizeof\(PLASMA_Complex32_t\)\*([\s\S]*?),([\s]*)([\w]*),',
+           'QUARK_Insert_Task(\\1sizeof(MORSE_Complex32_t)*\\2,\\3RTBLKADDR(\\4, MORSE_Complex32_t, \\4m, \\4n),'                                        ),
+    ( 'u', 'RTBLKADDR\(NULL, MORSE_Complex64_t, NULLm, NULLn\)' ,                         'NULL'                                                         ),
+
+    ( 'u', 'QUARK_CORE',                                                                  'MORSE_TASK'                                                   ),
+    ( 'u', 'PLASMA',                                                                      'MORSE'                                                        ),
+    ( 'u', 'Plasma',                                                                      'Morse'                                                        ),
+    ( 'u', 'plasma',                                                                      'morse'                                                        ),
+
+    ( 'u', 'qwrapper_([\w]*).c',                                                          'codelet_\\1.c'                                                ),
+    ( 'u', 'core_blas quark wrapper',                                                     'codelets kernel'                                              ),
+
+    # Add patch to remove REGION_D and REGION_U in codelet_zttlqt.c + codelet_zttqrt.c
+    ( 'r', 'QUARK_Insert_Task\(([^;]*)CORE_zttqrt_quark([^;]*)\|([\s]*)QUARK_REGION_D([\s]*)\|([\s]*)QUARK_REGION_U',
+           'QUARK_Insert_Task(\\1CORE_zttqrt_quark\\2' ),
+    ( 'r', 'QUARK_Insert_Task\(([^;]*)CORE_zttlqt_quark([^;]*)\|([\s]*)QUARK_REGION_D([\s]*)\|([\s]*)QUARK_REGION_L',
+           'QUARK_Insert_Task(\\1CORE_zttlqt_quark\\2' ),
+    # end patch
+
+    # Suppress additional functions (ex: gemm2, gemm_f2...)
+    ( 'u', '\n([\s\w]*)([\w]*)([\s]*)CORE_zgemm_([\w]+)_quark\(([^)]*)\)([\s]*){([\s\S]*?)\n}' , ''                                                      ),
+    ( 'u', '\n([\s\w]*)([\w]*)([\s]*)MORSE_TASK_zgemm_([\w]+)\(([^)]*)\)([\s]*){([\s\S]*?)\n}' , ''                                                      ),
+    ( 'u', '\n([\s\w]*)([\w]*)([\s]*)CORE_zgemm([0-9]+)_quark\(([^)]*)\)([\s]*){([\s\S]*?)\n}' , ''                                                      ),
+    ( 'u', '\n([\s\w]*)([\w]*)([\s]*)MORSE_TASK_zgemm([0-9]+)\(([^)]*)\)([\s]*){([\s\S]*?)\n}' , ''                                                      ),
+    ( 'u', '\n([\s\w]*)([\w]*)([\s]*)CORE_ztrmm_([\w]+)_quark\(([^)]*)\)([\s]*){([\s\S]*?)\n}' , ''                                                      ),
+    ( 'u', '\n([\s\w]*)([\w]*)([\s]*)MORSE_TASK_ztrmm_([\w]+)\(([^)]*)\)([\s]*){([\s\S]*?)\n}' , ''                                                      ),
+    ( 'u', '/\*([\s\*]*)\*/([\s]*)/\*([\s\*]*)\*/\n' ,                                           ''                                                      ),
+    # end suppress
+
+    # Special remove of Rnd64_jump
+    ( 'u', '#define COMPLEX([\s\S]*)static unsigned long long int([\s]*)Rnd64_jump([\s\S]*)return([\s\w]*);([\s]*)}', ''                                 ),
+    # end remove
+  ],
+
+  # ------------------------------------------------------------
+  # replacements applied to codelet_starpu files.
+  'codelet_starpu' : [
+    # Transformation for cl_***_cpu_func
+    ( 'u', '#include "morse_quark.h"',                                                    '#include "morse_starpu.h"'                                    ),
+    ( 'u', 'void([ \t]*)CORE_([\w]*)_quark\(([^)]*)\)',                                   'static void cl_\\2_cpu_func(void *descr[], void *cl_arg)'     ),
+    ( 'u', '\n([ \t]*)MORSE_sequence_t([ \t]*)\*sequence;([ \t]*)\n',                     '\n'                                                           ),
+    ( 'u', '\n([ \t]*)MORSE_request_t([ \t]*)\*request;([ \t]*)\n',                       '\n'                                                           ),
+    ( 'u', '\n([ \t]*)if([\s\S]*?)RUNTIME_sequence_flush([^;]*);([ \t]*)\n',              '\n'                                                           ),
+    ( 'u', 'int info;',                                                                   'int info = 0;'                                                ),
+    ( 'u', 'quark_unpack_args_([\w]*)\(([\s]*)quark([\s]*),',                             'starpu_codelet_unpack_args(cl_arg,'                           ),
+    ( 'u', 'starpu_codelet_unpack_args\(([^;]*),([\s]*)sequence([^)]*)',                  'starpu_codelet_unpack_args(\\1\\3'                            ),
+    ( 'u', 'starpu_codelet_unpack_args\(([^;]*),([\s]*)request([^;]*)',                   'starpu_codelet_unpack_args(\\1\\3'                            ),
+    ( 'r', 'starpu_codelet_unpack_args\(([^;]*),([\s]*)([^&\s]+)([^;]*);',                'starpu_codelet_unpack_args(\\1,\\2&\\3\\4;'                   ),
+    ( 'r', 'RTBLKADDR\(([ \t]*)([\w]+)([\s\S]*)MORSE_Complex64_t([ \t]*)\*\\2;([\s\S]*)\n([ \t]*)starpu_codelet_unpack_args([^;]*),([\s]*)&\\2([,\\)]+)',
+      'RTBLKADDR(\\1\\2\\3MORSE_Complex64_t\\4*\\2;\\5\n\\6\\2 = (MORSE_Complex64_t *)STARPU_MATRIX_GET_PTR(descr[0]);\n\\6starpu_codelet_unpack_args\\7\\9'),
+
+    # repeat: We need to repeat manually to increase the index of descr
+    ( 'u', 'descr\[0\]\);([ \t\n]*)([\w]*) = \(MORSE_Complex64_t \*\)STARPU_MATRIX_GET_PTR\(descr\[0\]',
+           'descr[0]);\\1\\2 = (MORSE_Complex64_t *)STARPU_MATRIX_GET_PTR(descr[1]'                                                                      ),
+    ( 'u', 'descr\[1\]\);([ \t\n]*)([\w]*) = \(MORSE_Complex64_t \*\)STARPU_MATRIX_GET_PTR\(descr\[0\]',
+           'descr[1]);\\1\\2 = (MORSE_Complex64_t *)STARPU_MATRIX_GET_PTR(descr[2]'                                                                      ),
+    ( 'u', 'descr\[2\]\);([ \t\n]*)([\w]*) = \(MORSE_Complex64_t \*\)STARPU_MATRIX_GET_PTR\(descr\[1\]',
+           'descr[2]);\\1\\2 = (MORSE_Complex64_t *)STARPU_MATRIX_GET_PTR(descr[3]'                                                                      ),
+    ( 'u', 'descr\[3\]\);([ \t\n]*)([\w]*) = \(MORSE_Complex64_t \*\)STARPU_MATRIX_GET_PTR\(descr\[2\]',
+           'descr[3]);\\1\\2 = (MORSE_Complex64_t *)STARPU_MATRIX_GET_PTR(descr[4]'                                                                      ),
+    ( 'u', 'descr\[4\]\);([ \t\n]*)([\w]*) = \(MORSE_Complex64_t \*\)STARPU_MATRIX_GET_PTR\(descr\[3\]',
+           'descr[4]);\\1\\2 = (MORSE_Complex64_t *)STARPU_MATRIX_GET_PTR(descr[5]'                                                                      ),
+    ( 'u', 'descr\[5\]\);([ \t\n]*)([\w]*) = \(MORSE_Complex64_t \*\)STARPU_MATRIX_GET_PTR\(descr\[4\]',
+           'descr[5]);\\1\\2 = (MORSE_Complex64_t *)STARPU_MATRIX_GET_PTR(descr[6]'                                                                      ),
+    ( 'u', 'descr\[6\]\);([ \t\n]*)([\w]*) = \(MORSE_Complex64_t \*\)STARPU_MATRIX_GET_PTR\(descr\[5\]',
+           'descr[6]);\\1\\2 = (MORSE_Complex64_t *)STARPU_MATRIX_GET_PTR(descr[7]'                                                                      ),
+    ( 'u', 'descr\[7\]\);([ \t\n]*)([\w]*) = \(MORSE_Complex64_t \*\)STARPU_MATRIX_GET_PTR\(descr\[6\]',
+           'descr[7]);\\1\\2 = (MORSE_Complex64_t *)STARPU_MATRIX_GET_PTR(descr[8]'                                                                      ),
+    ( 'u', 'descr\[8\]\);([ \t\n]*)([\w]*) = \(MORSE_Complex64_t \*\)STARPU_MATRIX_GET_PTR\(descr\[7\]',
+           'descr[8]);\\1\\2 = (MORSE_Complex64_t *)STARPU_MATRIX_GET_PTR(descr[9]'                                                                      ),
+    ( 'u', 'descr\[9\]\);([ \t\n]*)([\w]*) = \(MORSE_Complex64_t \*\)STARPU_MATRIX_GET_PTR\(descr\[8\]',
+           'descr[9]);\\1\\2 = (MORSE_Complex64_t *)STARPU_MATRIX_GET_PTR(descr[9]'                                                                      ),
+    # end repeat
+    ( 'r', 'cl_([\w]*)_cpu_func\(([\s\S]*?)STARPU_MATRIX_GET_PTR\(descr\[0\]\);([\s]*)starpu_codelet_unpack_args([\s\S]*)$',
+      'TREATED_\\1_cpu_func(\\2STARPU_MATRIX_GET_PTR(descr[0]);\\3starpu_codelet_unpack_args\\4/*\n * Codelet definition\n */\nCODELETS_CPU(\\1, 1, cl_\\1_cpu_func)\n' ),
+    ( 'r', 'cl_([\w]*)_cpu_func\(([\s\S]*?)STARPU_MATRIX_GET_PTR\(descr\[1\]\);([\s]*)starpu_codelet_unpack_args([\s\S]*)$',
+      'TREATED_\\1_cpu_func(\\2STARPU_MATRIX_GET_PTR(descr[1]);\\3starpu_codelet_unpack_args\\4/*\n * Codelet definition\n */\nCODELETS_CPU(\\1, 2, cl_\\1_cpu_func)\n' ),
+    ( 'r', 'cl_([\w]*)_cpu_func\(([\s\S]*?)STARPU_MATRIX_GET_PTR\(descr\[2\]\);([\s]*)starpu_codelet_unpack_args([\s\S]*)$',
+      'TREATED_\\1_cpu_func(\\2STARPU_MATRIX_GET_PTR(descr[2]);\\3starpu_codelet_unpack_args\\4/*\n * Codelet definition\n */\nCODELETS_CPU(\\1, 3, cl_\\1_cpu_func)\n' ),
+    ( 'r', 'cl_([\w]*)_cpu_func\(([\s\S]*?)STARPU_MATRIX_GET_PTR\(descr\[3\]\);([\s]*)starpu_codelet_unpack_args([\s\S]*)$',
+      'TREATED_\\1_cpu_func(\\2STARPU_MATRIX_GET_PTR(descr[3]);\\3starpu_codelet_unpack_args\\4/*\n * Codelet definition\n */\nCODELETS_CPU(\\1, 4, cl_\\1_cpu_func)\n' ),
+    ( 'r', 'cl_([\w]*)_cpu_func\(([\s\S]*?)STARPU_MATRIX_GET_PTR\(descr\[4\]\);([\s]*)starpu_codelet_unpack_args([\s\S]*)$',
+      'TREATED_\\1_cpu_func(\\2STARPU_MATRIX_GET_PTR(descr[4]);\\3starpu_codelet_unpack_args\\4/*\n * Codelet definition\n */\nCODELETS_CPU(\\1, 5, cl_\\1_cpu_func)\n' ),
+    ( 'r', 'cl_([\w]*)_cpu_func\(([\s\S]*?)STARPU_MATRIX_GET_PTR\(descr\[5\]\);([\s]*)starpu_codelet_unpack_args([\s\S]*)$',
+      'TREATED_\\1_cpu_func(\\2STARPU_MATRIX_GET_PTR(descr[5]);\\3starpu_codelet_unpack_args\\4/*\n * Codelet definition\n */\nCODELETS_CPU(\\1, 6, cl_\\1_cpu_func)\n' ),
+    ( 'r', 'cl_([\w]*)_cpu_func\(([\s\S]*?)STARPU_MATRIX_GET_PTR\(descr\[6\]\);([\s]*)starpu_codelet_unpack_args([\s\S]*)$',
+      'TREATED_\\1_cpu_func(\\2STARPU_MATRIX_GET_PTR(descr[6]);\\3starpu_codelet_unpack_args\\4/*\n * Codelet definition\n */\nCODELETS_CPU(\\1, 7, cl_\\1_cpu_func)\n' ),
+    ( 'r', 'cl_([\w]*)_cpu_func\(([\s\S]*?)STARPU_MATRIX_GET_PTR\(descr\[7\]\);([\s]*)starpu_codelet_unpack_args([\s\S]*)$',
+      'TREATED_\\1_cpu_func(\\2STARPU_MATRIX_GET_PTR(descr[7]);\\3starpu_codelet_unpack_args\\4/*\n * Codelet definition\n */\nCODELETS_CPU(\\1, 8, cl_\\1_cpu_func)\n' ),
+    ( 'r', 'cl_([\w]*)_cpu_func\(([\s\S]*?)STARPU_MATRIX_GET_PTR\(descr\[8\]\);([\s]*)starpu_codelet_unpack_args([\s\S]*)$',
+      'TREATED_\\1_cpu_func(\\2STARPU_MATRIX_GET_PTR(descr[8]);\\3starpu_codelet_unpack_args\\4/*\n * Codelet definition\n */\nCODELETS_CPU(\\1, 9, cl_\\1_cpu_func)\n' ),
+    ( 'u', 'TREATED',                                                                     'cl'                                                           ),
+    # end Transformation
+
+    # Transformation for MORSE_TASK
+    ( 'u', '\n([ \t]*)DAG_CORE_([\w]*);\n',                                               '\n'                                                           ),
+    ( 'u', 'QUARK_Insert_Task',                                                           'starpu_insert_task'                                           ),
+    ( 'u', 'options->quark([\s\S]*?)options->task_flags,',                                'codelet,'                                                     ),
+    ( 'u', 'MORSE_TASK_([\w]*)\(([^)]*)\)([\s]*){([\s]*)([\w])',
+           'MORSE_TASK_\\1(\\2)\\3{\\4(void)nb;\\4struct starpu_codelet *codelet = &cl_\\1;\\4void (*callback)(void*) = options->profiling ? cl_\\1_callback : NULL;\\4\\5' ),
+    ( 'r', 'starpu_insert_task\(([^;]*)\|([\s]*)LOCALITY([^;]*?)',              'starpu_insert_task(\\1\\3'                                              ),
+    ( 'r', 'starpu_insert_task\(([^;]*)\|([\s]*)QUARK_REGION_D([^;]*?)',        'starpu_insert_task(\\1\\3'                                              ),
+    ( 'r', 'starpu_insert_task\(([^;]*)\|([\s]*)QUARK_REGION_U([^;]*?)',        'starpu_insert_task(\\1\\3'                                              ),
+    ( 'r', 'starpu_insert_task\(([^;]*)\|([\s]*)QUARK_REGION_L([^;]*?)',        'starpu_insert_task(\\1\\3'                                              ),
+    ( 'r', 'starpu_insert_task\(([^;]*)sizeof\(MORSE_request_t([ \t]*)\*\)([\s\S]*?),([\s\S]*?),([\s\S]*?),([ \t]*)\n([ \t]*)sizeof',
+           'starpu_insert_task(\\1sizeof'                                                                                                                ),
+    ( 'r', 'starpu_insert_task\(([^;]*)sizeof\(MORSE_sequence_t([ \t]*)\*\)([\s\S]*?),([\s\S]*?),([\s\S]*?),([ \t]*)\n([ \t]*)sizeof',
+           'starpu_insert_task(\\1sizeof'                                                                                                                ),
+    ( 'r', 'starpu_insert_task\(([^;]*)sizeof\(([^,]*),([\s]*)RTBLKADDR\(([^)]*)\),([\s]*)([\S]*)([\s]*),',
+           'starpu_insert_task(\\1\\6,\\5RTBLKADDR(\\4),'                                                                                                ),
+    ( 'r', 'starpu_insert_task\(([^;]*)sizeof\(([^,]*),([\s]*)([\S]*)([\s]*),([\s]*)([\S]*)([\s]*),',
+           'starpu_insert_task(\\1\\7,\\6\\4\\5,\\3CONV_BACKUP(\\2,'                                                                                     ),
+
+    ( 'r', 'starpu_insert_task\(([^;]*)CONV_BACKUP([^;]*)',                               'starpu_insert_task(\\1sizeof\\2'                              ),
+    ( 'r', 'starpu_insert_task\(([^;]*)VALUE([^;]*)',                                     'starpu_insert_task(\\1STVAL\\2'                               ),
+    ( 'r', 'starpu_insert_task\(([^;]*)STVAL([^;]*)',                                     'starpu_insert_task(\\1STARPU_VALUE\\2'                        ),
+    ( 'r', 'starpu_insert_task\(([^;]*)INOUT([^;]*)',                                     'starpu_insert_task(\\1STARPU_RW\\2'                           ),
+    ( 'r', 'starpu_insert_task\(([^;]*)INPUT([^;]*)',                                     'starpu_insert_task(\\1STARPU_R\\2'                            ),
+    ( 'r', 'starpu_insert_task\(([^;]*)OUTPUT([^;]*)',                                    'starpu_insert_task(\\1STARPU_W\\2'                            ),
+    ( 'r', 'starpu_insert_task\(([^;]*)SCRATCH([^;]*)',                                   'starpu_insert_task(\\1STARPU_TREATED\\2'                      ),
+    ( 'u', 'TREATED',                                                                     'SCRATCH'                                                      ),
+    ( 'u', 'starpu_insert_task\(([^;]*),([\s]*) 0\);',
+           'starpu_insert_task(\\1,\\2 STARPU_PRIORITY,\toptions->priority,\\2 STARPU_CALLBACK,\tcallback,\\2 0);'                                       ),
+    # end Transformation
+
+    # Special transformation for IPIV
+    ( 'u', 'STARPU_([\w]*),([\s]*)IPIV,([\s]*)sizeof\(int\)([^,]*)',                      'STARPU_VALUE,\\2&IPIV,\\3sizeof(int*)'                        ),
+
+    # Special remove
+    ( 'u', 'MORSE_TASK_zlaset2\(([^)]*)\)([\s]*){([\s]*)\(void\)nb;',                     'MORSE_TASK_zlaset2(\\1)\\2{\\3'                               ),
+    ( 'u', 'MORSE_TASK_zlaset\(([^)]*)\)([\s]*){([\s]*)\(void\)nb;',                      'MORSE_TASK_zlaset(\\1)\\2{\\3'                                ),
+    ( 'u', 'MORSE_TASK_zplghe\(([^)]*)\)([\s]*){([\s]*)\(void\)nb;',                      'MORSE_TASK_zplghe(\\1)\\2{\\3'                                ),
+    ( 'u', 'MORSE_TASK_zplrnt\(([^)]*)\)([\s]*){([\s]*)\(void\)nb;',                      'MORSE_TASK_zplrnt(\\1)\\2{\\3'                                ),
+    ( 'u', 'MORSE_TASK_zplgsy\(([^)]*)\)([\s]*){([\s]*)\(void\)nb;',                      'MORSE_TASK_zplgsy(\\1)\\2{\\3'                                ),
+    # end remove
+    ( 'u', '/([\s\\*\\/]*?)/',                                                            ''                                                             ),
+  ],
+
+  # ------------------------------------------------------------
+  # replacements applied to codelet_starpu files (workspace).
+  'codelet_starpu_ws' : [
+    # Suppress multiple SCRATCH
+    ( 'r', 'starpu_insert_task\(([^;]*)\n^([\s]*)STARPU_SCRATCH,([\s]*)NULL,([^,]*),([^;]*)^([\s]*)STARPU_SCRATCH,([\s]*)NULL,([^,]*),',
+           'starpu_insert_task(\\1\\5\\6STARPU_SCRATCH,\\7NULL,\\8,'                                                                                     ),
+    ( 'u', '^([\s]*)STARPU_SCRATCH,([\s]*)NULL,([^,]*),',
+           '\\1STARPU_VALUE,\\2&h_work, sizeof(MORSE_starpu_ws_t *),\n\\1STARPU_VALUE,\\2&d_work, sizeof(MORSE_starpu_ws_t *),'                          ),
+    ( 'u', '^([ \t]*)starpu_insert_task', '\\1MORSE_starpu_ws_t *h_work = (MORSE_starpu_ws_t*)(options->ws_host);\n\\1MORSE_starpu_ws_t *d_work = (MORSE_starpu_ws_t*)(options->ws_device);\n\n\\1starpu_insert_task' ),
+    # Modify cl_***_cpu_func
+    ( 'u', 'static void cl_([\w]*)([^{]*?){', 'static void cl_\\1\\2{\n\tMORSE_starpu_ws_t *h_work;\n\tMORSE_starpu_ws_t *d_work;'                       ),
+    ( 'r', 'MORSE_Complex64_t([\s]*)\*([\w]*);([\s\S]*?)^([\s]*)starpu_codelet_unpack_args\(([^;]*)\&\\2([,\)])([^;]*);',
+      'MORSE_Complex64_tDONE\\1*\\2;\\3\\4starpu_codelet_unpack_args(\\5&\\2\\6\\7;\n\\4\\2 = (MORSE_Complex64_t*)RUNTIME_starpu_ws_getlocal(h_work);'   ),
+    ( 'r', 'MORSE_Complex64_tDONE([\s]*)\*([\w]*);([\s\S]*?)^([\s]*)starpu_codelet_unpack_args\(([^;]*)\&\\2([,\)])',
+           'MORSE_Complex64_tDONE\\1*\\2;\\3\\4starpu_codelet_unpack_args(\\5CLSCRATCH\\6'                                                               ),
+    ( 'r', 'starpu_codelet_unpack_args\(([^;]*)CLSCRATCH([,\)])([^;]*)CLSCRATCH([,\)])',
+           'starpu_codelet_unpack_args(\\1\\3CLSCRATCH\\4'                                                                                               ),
+    ( 'u', 'starpu_codelet_unpack_args\(([^;]*)CLSCRATCH',                                'starpu_codelet_unpack_args(\\1&h_work, &d_work'               ),
+    ( 'u', 'MORSE_Complex64_tDONE',                                                       'MORSE_Complex64_t'                                            ),
+    # Specifc transformation - change order of WORK and TAU
+    ( 'u', 'WORK([^;]*)RUNTIME_starpu_ws_getlocal([^;]*);([\s]*)TAU([^;]*)RUNTIME_starpu_ws_getlocal([^;]*);',
+           'TAU\\4RUNTIME_starpu_ws_getlocal\\5;\\3WORK = TAU + max( m, n );'                                                                            ),
+  ],
+
+  # ------------------------------------------------------------
+  # replacements applied to codelet_starpu files (cuda).
+  'codelet_starpu_cuda' : [
+    # Transformation for cl_***_cuda_func (cublas)
+    ( 'u', 'static void cl_([\w]*)_cpu_func\(([^)]*)\)([\s]*){([\s\S]*?)}',
+           'static void cl_\\1_cpu_func(\\2)\\3{\\4}\n\n#ifdef MORSE_USE_CUDA\nstatic void cl_\\1_cuda_func(\\2)\\3{\\4}\n#endif\n'                      ),
+    ( 'u', 'cl_([\w]*)_cuda_func\(([^)]*)\)([\s]*){([\s\S]*?)return([\s]*);([\s\S]*?)}',         'cl_\\1_cuda_func(\\2)\\3{\\4\\6}'                      ),
+    ( 'u', 'cl_([\w]*)_cuda_func\(([^)]*)\)([\s]*){([\s\S]*?)}',                'cl_\\1_cuda_func(\\2)\\3{\\4\n\tcudaThreadSynchronize();\n\treturn;\n}' ),
+    ( 'r', 'cl_([\w]*)_cuda_func\(([^)]*)\)([\s]*){([\s\S]*?)cblas_z([\s\S]*?)}',                'cl_\\1_cuda_func(\\2)\\3{\\4cublasZ\\5}'               ),
+    ( 'r', 'cl_([\w]*)_cuda_func\(([^)]*)\)([\s]*){([\s\S]*?)MORSE_Complex64_t([\s\S]*?)}',      'cl_\\1_cuda_func(\\2)\\3{\\4cuDoubleComplex\\5}'       ),
+    ( 'r', 'cl_([\w]*)_cuda_func\(([^)]*)\)([\s]*){([\s\S]*?)CBLAS_SADDR\(([\w]*)\)([\s\S]*?)}', 'cl_\\1_cuda_func(\\2)\\3{\\4\\5\\6}'                   ),
+    ( 'r', 'cl_([\w]*)_cuda_func\(([^)]*)\)([\s]*){([\s\S]*?)([\s]*)CblasColMajor,([\s\S]*?)}',  'cl_\\1_cuda_func(\\2)\\3{\\4\\6}'                      ),
+    ( 'r', 'cl_([\w]*)_cuda_func\(([^)]*)\)([\s]*){([\s\S]*?)\(CBLAS_([A-Z]*)\)([\w]*),([\s\S]*?)}',
+           'cl_\\1_cuda_func(\\2)\\3{\\4lapack_const(\\6),\\7}'                                                                                          ),
+    # end Transformation
+
+    # Transformation for cl_***_cuda_func (geadd)
+    ( 'u', 'cl_zgeadd_cuda_func\(([^)]*)\)([\s]*){([\s]*)int([\s\S]*?)}',                        'cl_zgeadd_cuda_func(\\1)\\2{\\3int j;\n\tint\\4}'      ),
+    ( 'u', 'cl_zgeadd_cuda_func\(([^)]*)\)([\s]*){([\s\S]*?)CORE_zgeadd\(M, N, alpha, A, LDA, B, LDB\);([\s\S]*?)}',
+           'cl_zgeadd_cuda_func(\\1)\\2{\\3if (M == LDA && M == LDB)\n\t\tcublasZaxpy(M*N, alpha, A, 1, B, 1);\n\telse {\n\t\tfor (j = 0; j < N; j++)\n\t\t\tcublasZaxpy(M, alpha, A + j*LDA, 1, B + j*LDB, 1);\n\t}\n\\4}' ),
+    # end Transformation
+
+    # Transformation for cl_***_cuda_func (magma)
+    ( 'u', 'cl_([\w]*)_cuda_func\(([^)]*)\)([\s]*){([\s\S]*?)int info = 0;([\s\S]*?)}',     'cl_\\1_cuda_func(\\2)\\3{\\4int ret;\n\tint info = 0;\\5}'  ),
+    ( 'r', 'cl_([\w]*)_cuda_func\(([^)]*)\)([\s]*){([\s\S]*?)([\s]*)LAPACK_COL_MAJOR,([\s\S]*?)}', 'cl_\\1_cuda_func(\\2)\\3{\\4\\6}'                    ),
+    ( 'r', 'cl_([\w]*)_cuda_func\(([^)]*)\)([\s]*){([\s\S]*?)info = LAPACKE_([\w]*)_work([\s\S]*?)}',
+           'cl_\\1_cuda_func(\\2)\\3{\\4ret = magma_\\5_gpu\\6}'                                                                                         ),
+    ( 'r', 'cl_([\w]*)_cuda_func\(([^)]*)\)([\s]*){([\s\S]*?)int([\s\S]*?)LAPACKE_([\w]*)_work([\s\S]*?)}',
+           'cl_\\1_cuda_func(\\2)\\3{\\4int ret;\n\tint\\5ret = magma_\\6_gpu\\7}'                                                                       ),
+    ( 'u', 'cl_([\w]*)_cuda_func\(([^)]*)\)([\s]*){([\s\S]*?)ret = magma_([^;]*)\);([\s\S]*?)}',
+           'cl_\\1_cuda_func(\\2)\\3{\\4ret = magma_\\5, &info);\\6}' ),
+    ( 'u', 'cl_([\w]*)_cuda_func\(([^)]*)\)([\s]*){([\s\S]*?)ret = magma_([^;]*);([\s\S]*?)}',
+      'cl_\\1_cuda_func(\\2)\\3{\\4ret = magma_\\5;\n\t if (ret != MAGMA_SUCCESS) {\n\t\tfprintf(stderr, "Error in MAGMA: %d\\\\n", ret);\n\t\texit(-1);\n\t}\\6}' ),
+    # end Transformation
+
+    # Transformation for cl_***_cuda_func (magmablas)
+    ( 'u', 'cl_zlaset_cuda_func\(([^)]*)\)([\s]*){([\s\S]*?)magma_zlaset_gpu([\s\S]*?)}', 'cl_zlaset_cuda_func(\\1)\\2{\\3magmablas_zlaset\\4}'          ),
+    # end Transformation
+
+    # Speccific add
+    ( 'u', 'cl_zlauum_cuda_func\(([^)]*)\)([\s]*){([\s\S]*?)int ret;([\s\S]*?)}',        'cl_zlauum_cuda_func(\\1)\\2{\\3int ret;\n\tint info = 0;\\4}'  ),
+    #end add
+
+    ( 'u', 'CODELETS_CPU\(([\w]*), ([\w]*), cl_([\w]*)_cpu_func\)',                       'CODELETS(\\1, \\2, cl_\\3_cpu_func, cl_\\3_cuda_func)'        ),
+  ],
+
+  # ------------------------------------------------------------
+  # replacements applied to codelet_starpu files (opencl).
+  'codelet_starpu_opencl' : [
+    # Transformation for cl_***_opencl_func
+    # end Transformation
+  ],
+  # ------------------------------------------------------------
+  # replacements applied to specific headers
+  'include_coreblas' : [
+    ( 'u', 'void([ \t]*)QUARK_CORE_([^)]*)\);([^\n]*)\n',                                 ''                                                             ),
+    ( 'u', 'int([ \t]*)QUARK_CORE_([^)]*)\);([^\n]*)\n',                                  ''                                                             ),
+    ( 'u', 'void([ \t]*)CORE_([\w]*)_quark([^;]*);([^\n]*)\n',                            ''                                                             ),
+    ( 'u', '/([^/]*)called by PLASMA([^/]*)/\n',                                          ''                                                             ),
+    ( 'u', '/([^/]*)called by QUARK([^/]*)/\n',                                           ''                                                             ),
+    ( 'u', '#ifdef COMPLEX([ \t]*)\n#endif([ \t]*)\n',                                    ''                                                             ),
+    ( 'u', 'PLASMA_desc',                                                                 'MORSE_desc_t'                                                 ),
+    ( 'u', 'PLASMA_Complex64_t',                                                          'MORSE_Complex64_t'                                            ),
+    ( 'u', 'PLASMA_Complex32_t',                                                          'MORSE_Complex32_t'                                            ),
+    ( 'u', 'PLASMA_enum',                                                                 'MORSE_enum'                                                   ),
+    ( 'u', 'PLASMA_CORE',                                                                 'MORSE_CORE'                                                   ),
+  ],
+  #
+  #
+  'include_runtime' : [
+    ( 'u', 'core_zblas.h',                                                                'runtime_z.h'                                                  ),
+    ( 'u', 'core_zcblas.h',                                                               'runtime_zc.h'                                                 ),
+    ( 'u', '_PLASMA_CORE_',                                                               '_RUNTIME_'                                                    ),
+    ( 'u', 'void([ \t]*)CORE_([^)]*)\);([^\n]*)\n',                                       ''                                                             ),
+    ( 'u', 'int([ \t]*)CORE_([^)]*)\);([^\n]*)\n',                                        ''                                                             ),
+    ( 'u', '#ifdef COMPLEX([ \t]*)\n#endif([ \t]*)\n',                                    ''                                                             ),
+    ( 'u', '/([^/]*)serial kernels([^/]*)/\n',                                            ''                                                             ),
+    ( 'u', '/([^/]*)called by QUARK([^/]*)/\n',                                           ''                                                             ),
+
+    ( 'u', 'Quark([\s]*)\*quark,([\s]*)Quark_Task_Flags([\s]*)\*task_flags,',             'MORSE_option_t *options,'                                     ),
+    ( 'u', 'PLASMA_sequence([^,]*)sequence\)',                                            ')'                                                            ),
+    ( 'u', 'PLASMA_request([^,]*)request\)',                                              ')'                                                            ),
+    ( 'u', 'PLASMA_sequence([^,]*)sequence,',                                             ''                                                             ),
+    ( 'u', 'PLASMA_request([^,]*)request,',                                               ''                                                             ),
+    ( 'u', 'void([ \t]*)QUARK_CORE_([^)]*),([\s]*)\);',                                   'void\\1QUARK_CORE_\\2);'                                      ),
+    ( 'u', 'int([ \t]*)QUARK_CORE_([^)]*),([\s]*)\);',                                    'int\\1QUARK_CORE_\\2);'                                       ),
+    ( 'r', 'QUARK_CORE([\w]*)\(([\s\S]*)const ([ \t\w]*)\*([\w]*),' ,                     'QUARK_CORE\\1(\\2\\3*\\4,'                                    ),
+    ( 'r', 'QUARK_CORE([\w]*)\(([\s\S]*)PLASMA_Complex64_t([ \t]*)\*([\w]*),' ,           'QUARK_CORE\\1(\\2MORSE_desc_t *\\4, int \\4m, int \\4n,'      ),
+    ( 'r', 'QUARK_CORE([\w]*)\(([\s\S]*)PLASMA_Complex32_t([ \t]*)\*([\w]*),' ,           'QUARK_CORE\\1(\\2MORSE_desc_t *\\4, int \\4m, int \\4n,'      ),
+
+    ( 'u', 'PLASMA_sequence',                                                             'MORSE_sequence_t'                                             ),
+    ( 'u', 'PLASMA_request',                                                              'MORSE_request_t'                                              ),
+    ( 'u', 'PLASMA_desc',                                                                 'MORSE_desc_t'                                                 ),
+
+    ( 'u', 'QUARK_CORE',                                                                  'MORSE_TASK'                                                   ),
+    ( 'u', 'PLASMA',                                                                      'MORSE'                                                        ),
+  ],
+  #
+  #
+  'include_quarkblas' : [
+    ( 'u', 'core_zblas.h',                                                                'quark_zblas.h'                                                ),
+    ( 'u', 'core_zcblas.h',                                                               'quark_zcblas.h'                                               ),
+    ( 'u', '_PLASMA_CORE_',                                                               '_QUARK_'                                                      ),
+    ( 'u', 'void([ \t]*)CORE_([a-zA-Z0-9]*)\(([^)]*)\);([^\n]*)\n',                       ''                                                             ),
+    ( 'u', 'int([ \t]*)CORE_([a-zA-Z0-9]*)\(([^)]*)\);([^\n]*)\n',                        ''                                                             ),
+    ( 'u', 'void([ \t]*)CORE_([\w]*)_(^q])([a-zA-Z0-9]*)\(([^)]*)\);([^\n]*)\n',          ''                                                             ),
+    ( 'u', 'int([ \t]*)CORE_([\w]*)_([^q])([a-zA-Z0-9]*)\(([^)]*)\);([^\n]*)\n',          ''                                                             ),
+    ( 'u', 'void([ \t]*)QUARK_CORE_([^)]*)\);([^\n]*)\n',                                 ''                                                             ),
+    ( 'u', 'int([ \t]*)QUARK_CORE_([^)]*)\);([^\n]*)\n',                                  ''                                                             ),
+    ( 'u', '/([^/]*)called by PLASMA([^/]*)/\n',                                          ''                                                             ),
+    ( 'u', '/([^/]*) serial kernels([^/]*)/\n',                                           ''                                                             ),
+    ( 'u', '#ifdef COMPLEX([ \t]*)\n#endif([ \t]*)\n',                                    ''                                                             ),
+
+    ( 'u', 'PLASMA',                                                                      'MORSE'                                                        ),
+  ],
+  #
+  #
+  'include_morse' : [
+    ( 'u', 'PLASMA_sequence',                                                             'MORSE_sequence_t'                                             ),
+    ( 'u', 'PLASMA_request',                                                              'MORSE_request_t'                                              ),
+    ( 'u', 'PLASMA_desc',                                                                 'MORSE_desc_t'                                                 ),
+    ( 'u', 'PLASMA',                                                                      'MORSE'                                                        ),
+    ( 'u', 'plasma',                                                                      'morse'                                                        ),
+  ],
+
+  # ------------------------------------------------------------
+  # replacements applied to control files.
+  'control' : [
+    ( 'u', 'plasma_alloc_ipiv\(([\w]*), ([\w]*), PLASMA_FUNC_ZGESV, \(void([ ]*)\*\*\)IPIV\)',
+           'morse_alloc_ipiv(\\1, \\2, MORSE_FUNC_ZGESV, MorseComplexDouble, descL, (void**)IPIV)'                                                       ),
+    ( 'u', 'plasma_shared_alloc',                                                         'morse_desc_mat_alloc'                                         ),
+    ( 'u', 'Declarations of parallel functions \(static scheduling\)([\s\S]*?)Declarations of internal sequential functions',
+           'Declarations of internal sequential functions'                                                                                               ),
+    ( 'u', 'plasma_parallel_call_([\w]*)\(([\s\\\]*)plasma_([\w]*),([^;]*);',             'morse_\\3(\\4;'                                               ),
+    ( 'u', 'morse_pzlapack_to_tile\(([^;]*?);',                                           'morse_pzlapack_to_tile(A, lm, &descA, seq, req);'             ),
+    ( 'u', 'morse_pztile_to_lapack\(([^;]*?);',                                           'morse_pztile_to_lapack(&descA, A, lm, seq, req);'             ),
+    ( 'u', 'PLASMA_Dealloc_Handle_Tile',                                                  'MORSE_Dealloc_Workspace'                                      ),
+
+    ( 'u', 'PLASMA_sequence',                                                             'MORSE_sequence_t'                                             ),
+    ( 'u', 'PLASMA_request',                                                              'MORSE_request_t'                                              ),
+    ( 'u', 'PLASMA_desc([ \t]*)([\w])',                                                   'MORSE_desc_t\\1*\\2'                                          ),
+    ( 'u', 'PLASMA_desc',                                                                 'MORSE_desc_t'                                                 ),
+    ( 'u', 'plasma_context_t',                                                            'MORSE_context_t'                                              ),
+    ( 'u', 'PLASMA',                                                                      'MORSE'                                                        ),
+    ( 'u', 'Plasma',                                                                      'Morse'                                                        ),
+    ( 'u', 'plasma',                                                                      'morse'                                                        ),
+    ( 'u', '_quark',                                                                      ''                                                             ),
+
+    # Add morse_zdesc_alloc in compute_z.h
+    ( 'u', '#define morse_zdesc_alloc',
+           '#define morse_zdesc_alloc2(descA, mb, nb, lm, ln, i, j, m, n)         \\\n\tdescA = morse_desc_init(                                          \\\n\t\tMorseComplexDouble, (mb), (nb), ((mb)*(nb)),                  \\\n\t\t(m), (n), (i), (j), (m), (n));                                \\\n\tmorse_desc_mat_alloc( &(descA) );\n\n#define morse_zdesc_alloc' ),
+    # end add
+  ],
+
+  # ------------------------------------------------------------
+  # replacements applied to timing files.
+  'timing' : [
+    ( 'u', 'PLASMA_Dealloc_Handle_Tile',                                                  'MORSE_Dealloc_Workspace'                                      ),
+    ( 'u', 'PLASMA_sequence',                                                             'MORSE_sequence_t'                                             ),
+    ( 'u', 'PLASMA_request',                                                              'MORSE_request_t'                                              ),
+    ( 'u', 'PLASMA_desc',                                                                 'MORSE_desc_t'                                                 ),
+    ( 'u', 'real_Double_t',                                                               'morse_time_t'                                                 ),
+    ( 'u', 'PLASMA',                                                                      'MORSE'                                                        ),
+    ( 'u', 'Plasma',                                                                      'Morse'                                                        ),
+    ( 'u', 'plasma',                                                                      'morse'                                                        ),
+
+    # Add dirty getoncpu( descA ), will need to handle that within the sequence for exemple
+    ( 'u', '(MORSE_Sequence_Wait\([^;]*\);\n)([\s]*)STOP_TIMING',                         '\\1\\2MORSE_Desc_getoncpu( descA );\n\\2STOP_TIMING'          ),
+  ],
+
+  # ------------------------------------------------------------
+  # replacements applied to timing files.
+  'testing' : [
+    ( 'u', 'core_blas.h',                                                                 'coreblas.h'                                                   ),
+    ( 'u', 'testing_zmain.h',                                                             'testing_zauxiliary.h'                                         ),
+    ( 'u', 'real_Double_t',                                                               'morse_time_t'                                                 ),
+    ( 'u', 'int([\s]*)testing_([^{]*){',                                                  'int\\1testing_\\2{\n\tint hres = 0;'                          ),
+    ( 'u', 'int([\s]*)testing_([\s\S]*?)return 0;',                                       'int\\1testing_\\2return hres;'                                ),
+    ( 'u', 'int([\s]*)testing_([\s\S]*?)FAILED([^;]*?);',                                 'int\\1testing_\\2FAILED\\3;\thres++;'                         ),
+    ( 'u', 'PLASMA_desc',                                                                 'MORSE_desc_t'                                                 ),
+    ( 'u', 'PLASMA_Finalize',                                                             'MORSE_Finalize'                                               ),
+    ( 'u', 'PLASMA_Dealloc_Handle_Tile',                                                  'MORSE_Dealloc_Workspace'                                      ),
+
+    ( 'u', 'PLASMA',                                                                      'MORSE'                                                        ),
+    ( 'u', 'Plasma',                                                                      'Morse'                                                        ),
+    ( 'u', 'plasma',                                                                      'morse'                                                        ),
+
+    # Specific fix for testing_zgesv_incpiv (will be fix in plasma)
+    ( 'u', 'int testing_zgesv_incpiv\(([\s\S]*)MORSE_Complex64_t \*L;',                   'int testing_zgesv_incpiv(\\1MORSE_desc_t *L;'                 ),
+  ],
+
+  # --------------------------------------------------------
+  # replacements applied to ALL at the end.
+  'all_end' : [
+    ( 'u', 'provided by Univ. of Tennessee,',                           'provided by Inria Bordeaux - Sud-Ouest, LaBRI,'                                 ),
+    ( 'u', 'Univ. of California Berkeley and Univ. of Colorado Denver', 'University of Bordeaux, Bordeaux INP'                                          ),
+    ( 'u', '@version 2.6.0\n \* @author', 
+           '@version 2.6.0\n * @comment This file has been automatically generated\n *          from Plasma 2.6.0 for MORSE 1.0.0\n * @author'           ),
+    ( 'u', '/([\*]+)/\n/([\*]+)/',                                                        ''                                                             ),
+    ( 'u', '/([\*]+)/\n/',                                                                '\n/'                                                          ),
+    ( 'u', '/([\*]+)/([a-zA-Z]+)',                                                        '\\2'                                                          ),
+  ],
+};
+
+adds = {
+  # --------------------------------------------------------
+  # replacements applied to ALL files.
+  'all' : [
+    ( 'u', None , None ),
+  ],
+};