diff --git a/CMakeLists.txt b/CMakeLists.txt
index 56241c740fc6d15948492f151ceca3d5f96dd7a5..a881f77b843c349c00f8179b80716b176452e814 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,7 @@
 #
 # @copyright 2009-2014 The University of Tennessee and The University of
 #                      Tennessee Research Foundation. All rights reserved.
-# @copyright 2012-2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
+# @copyright 2012-2018 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
 #                      Univ. Bordeaux. All rights reserved.
 #
 ###
@@ -248,6 +248,11 @@ endif()
 #option(CHAMELEON_GEN_PREC "Generate source files precisions" ON)
 #------------------------------------------------------------------------------
 
+###############################################################################
+# Build dependency HQR library #
+################################
+add_subdirectory(hqr)
+include_directories(hqr/include)
 
 ###############################################################################
 # Look for dependencies #
@@ -258,22 +263,21 @@ set(CHAMELEON_DEP "")
 # ------------------------
 set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
 find_package(Threads REQUIRED)
-if( THREADS_FOUND )
+if( THREADS_FOUND AND CMAKE_THREAD_LIBS_INIT )
+  libraries_absolute_path(CMAKE_THREAD_LIBS_INIT "")
   list(APPEND EXTRA_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
 endif ()
 
 # Add math library to the list of extra
 # it normally exists on all common systems provided with a C compiler
-set(M_LIBRARIES "")
 if(UNIX OR WIN32)
     find_library(
-      M_m_LIBRARY
+      M_LIBRARY
       NAMES m
       )
-    mark_as_advanced(M_m_LIBRARY)
-    if (M_m_LIBRARY)
-      list(APPEND M_LIBRARIES "${M_m_LIBRARY}")
-      list(APPEND EXTRA_LIBRARIES "${M_m_LIBRARY}")
+    mark_as_advanced(M_LIBRARY)
+    if (M_LIBRARY)
+      list(APPEND EXTRA_LIBRARIES "${M_LIBRARY}")
     else()
       message(FATAL_ERROR "Could NOT find libm on your system."
         " Are you sure to a have a C compiler installed?")
@@ -282,16 +286,14 @@ endif()
 
 # Try to find librt (libposix4 - POSIX.1b Realtime Extensions library)
 # on Unix systems except Apple ones because it does not exist on it
-set(RT_LIBRARIES "")
 if(UNIX AND NOT APPLE)
     find_library(
-        RT_rt_LIBRARY
+        RT_LIBRARY
         NAMES rt
         )
-    mark_as_advanced(RT_rt_LIBRARY)
-    if (RT_rt_LIBRARY)
-        list(APPEND RT_LIBRARIES "${RT_rt_LIBRARY}")
-        list(APPEND EXTRA_LIBRARIES "${RT_rt_LIBRARY}")
+    mark_as_advanced(RT_LIBRARY)
+    if (RT_LIBRARY)
+        list(APPEND EXTRA_LIBRARIES "${RT_LIBRARY}")
     else()
         message(FATAL_ERROR "Could NOT find librt on your system")
     endif()
@@ -300,33 +302,24 @@ endif()
 # If simulation we don't enter in kernel functions so that we don't need to
 # link with concerned libraries
 if(NOT CHAMELEON_SIMULATION)
-
     # CHAMELEON depends on CBLAS
     #---------------------------
-    find_package(CBLAS COMPONENTS BLASEXT)
-    if(BLAS_FOUND)
-        if (BLAS_LIBRARY_DIRS)
-            # the RPATH to be used when installing
-            list(APPEND CMAKE_INSTALL_RPATH "${BLAS_LIBRARY_DIRS}")
+    find_package(CBLAS REQUIRED)
+    if(CBLAS_FOUND)
+        if (CBLAS_INCLUDE_DIRS_DEP)
+            include_directories(${CBLAS_INCLUDE_DIRS_DEP})
         endif()
-        if(BLAS_LINKER_FLAGS)
-            list(APPEND CMAKE_EXE_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
+        if(CBLAS_CFLAGS_OTHER_DEP)
+            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CBLAS_CFLAGS_OTHER_DEP}")
         endif()
-    else()
-        message(FATAL_ERROR "BLAS library has not been found")
-    endif()
-    if(CBLAS_FOUND)
-        include_directories(${CBLAS_INCLUDE_DIRS})
-        if(CBLAS_LIBRARY_DIRS)
-            # the RPATH to be used when installing
-            list(APPEND CMAKE_INSTALL_RPATH "${CBLAS_LIBRARY_DIRS}")
+        if(CBLAS_LDFLAGS_OTHER_DEP)
+            set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CBLAS_LDFLAGS_OTHER_DEP}")
         endif()
-        if (CBLAS_LIBRARIES)
-            if (CBLAS_LIBRARIES_DEP)
-                list(INSERT CHAMELEON_DEP 0 ${CBLAS_LIBRARIES_DEP})
-            else()
-                list(INSERT CHAMELEON_DEP 0 ${CBLAS_LIBRARIES})
-            endif()
+        if(CBLAS_LIBRARY_DIRS_DEP)
+            list(APPEND CMAKE_INSTALL_RPATH "${CBLAS_LIBRARY_DIRS_DEP}")
+        endif()
+        if (CBLAS_LIBRARIES_DEP)
+            list(INSERT CHAMELEON_DEP 0 ${CBLAS_LIBRARIES_DEP})
         endif()
     else()
         if(MORSE_VERBOSE_FIND_PACKAGE)
@@ -347,32 +340,22 @@ if(NOT CHAMELEON_SIMULATION)
 
     # CHAMELEON depends on LAPACKE
     #-----------------------------
-    # standalone version of lapacke seems useless for now
-    # let the comment in case we meet some problems of non existing lapacke
-    # functions in lapack library such as mkl, acml, ...
-    #set(LAPACKE_STANDALONE TRUE)
-    find_package(LAPACKE COMPONENTS LAPACKEXT)
-    if(LAPACK_FOUND AND LAPACK_LIBRARY_DIRS)
-        # the RPATH to be used when installing
-        list(APPEND CMAKE_INSTALL_RPATH "${LAPACK_LIBRARY_DIRS}")
-    else()
-        message(FATAL_ERROR "A LAPACK library is required but has not been found")
-    endif()
+    find_package(LAPACKE REQUIRED COMPONENTS TMG)
     if(LAPACKE_FOUND)
-        include_directories(${LAPACKE_INCLUDE_DIRS})
-        if(LAPACKE_LIBRARY_DIRS)
-            # the RPATH to be used when installing
-            list(APPEND CMAKE_INSTALL_RPATH "${LAPACKE_LIBRARY_DIRS}")
+        if (LAPACKE_INCLUDE_DIRS_DEP)
+            include_directories(${LAPACKE_INCLUDE_DIRS_DEP})
         endif()
-        if(LAPACKE_LINKER_FLAGS)
-            list(APPEND CMAKE_EXE_LINKER_FLAGS "${LAPACKE_LINKER_FLAGS}")
+        if(LAPACKE_CFLAGS_OTHER_DEP)
+            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LAPACKE_CFLAGS_OTHER_DEP}")
         endif()
-        if (LAPACKE_LIBRARIES)
-            if (LAPACKE_LIBRARIES_DEP)
-                list(INSERT CHAMELEON_DEP 0 ${LAPACKE_LIBRARIES_DEP})
-            else()
-                list(INSERT CHAMELEON_DEP 0 ${LAPACKE_LIBRARIES})
-            endif()
+        if(LAPACKE_LDFLAGS_OTHER_DEP)
+            set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LAPACKE_LDFLAGS_OTHER_DEP}")
+        endif()
+        if(LAPACKE_LIBRARY_DIRS_DEP)
+            list(APPEND CMAKE_INSTALL_RPATH "${LAPACKE_LIBRARY_DIRS_DEP}")
+        endif()
+        if (LAPACKE_LIBRARIES_DEP)
+            list(INSERT CHAMELEON_DEP 0 ${LAPACKE_LIBRARIES_DEP})
         endif()
     else()
         if(MORSE_VERBOSE_FIND_PACKAGE)
@@ -391,39 +374,16 @@ if(NOT CHAMELEON_SIMULATION)
         message(FATAL_ERROR "A LAPACKE library is required but has not been found")
     endif()
 
-    # CHAMELEON depends on TMG
-    #-------------------------
-    if (CHAMELEON_ENABLE_TESTING OR CHAMELEON_ENABLE_TIMING)
-        find_package(TMG)
-        if(TMG_FOUND AND TMG_LIBRARY_DIRS)
-            # the RPATH to be used when installing
-            list(APPEND CMAKE_INSTALL_RPATH "${TMG_LIBRARY_DIRS}")
-        else()
-            message(FATAL_ERROR "A TMG library is required but has not been found")
-        endif()
-        if(TMG_LINKER_FLAGS)
-            list(APPEND CMAKE_EXE_LINKER_FLAGS "${TMG_LINKER_FLAGS}")
-        endif()
-        if (TMG_LIBRARIES)
-            if (TMG_LIBRARIES_DEP)
-                list(INSERT CHAMELEON_DEP 0 ${TMG_LIBRARIES_DEP})
-            else()
-                list(INSERT CHAMELEON_DEP 0 ${TMG_LIBRARIES})
-            endif()
-        endif()
-    endif()
-
     # CHAMELEON depends on CUDA/CUBLAS
     #----------------------------------
     if (CHAMELEON_USE_CUDA)
 
         find_package(CUDA REQUIRED)
-
         if (CUDA_FOUND)
             message("-- ${Blue}Add definition CHAMELEON_USE_CUDA"
             " - Activate CUDA in Chameleon${ColourReset}")
+            libraries_absolute_path(CUDA_LIBRARIES "$ENV{CUDA_ROOT}/lib64")
             set(EXTRA_LIBRARIES_CUDA)
-            set(CHAMELEON_USE_CUDA 1)
             if(CUDA_VERSION VERSION_LESS "3.0")
                 set(CUDA_HOST_COMPILATION_CPP OFF)
             endif(CUDA_VERSION VERSION_LESS "3.0")
@@ -436,7 +396,6 @@ if(NOT CHAMELEON_SIMULATION)
                 "\n   cuda headers with your distribution of CUDA.")
             endif()
             if (CUDA_LIBRARIES)
-                list(APPEND EXTRA_SOURCES src/gpu_data.c)
                 set(saved_include "${CMAKE_REQUIRED_INCLUDES}")
                 set(saved_libs "${CMAKE_REQUIRED_LIBRARIES}")
                 set(CMAKE_REQUIRED_INCLUDES  "${CMAKE_REQUIRED_INCLUDES};${CUDA_INCLUDE_DIRS}")
@@ -452,7 +411,6 @@ if(NOT CHAMELEON_SIMULATION)
                 if (CUDA_CUBLAS_LIBRARIES)
                     message("-- ${Blue}Add definition CHAMELEON_USE_CUBLAS"
                     " - Use GPU kernels from cuBLAS${ColourReset}")
-                    set( CHAMELEON_USE_CUBLAS 1)
                     list(APPEND EXTRA_LIBRARIES_CUDA ${CUDA_CUBLAS_LIBRARIES})
                     list(APPEND EXTRA_LIBRARIES_CUDA ${CUDA_LIBRARIES}) # need CUDA libs to link.
                 else()
@@ -465,10 +423,6 @@ if(NOT CHAMELEON_SIMULATION)
                 "\n   CUDA_LIBRARIES to be found. Be sure you have"
                 "\n   libcuda with your distribution of CUDA.")
             endif()
-            #FindHeader(CUDA cublas_v2.h)
-            #if(CUDA_cublas_v2.h_DIRS)
-                #set(CHAMELEON_USE_CUBLAS_V2 1)
-            #endif()
         endif (CUDA_FOUND)
 
         list(APPEND EXTRA_LIBRARIES ${EXTRA_LIBRARIES_CUDA})
@@ -490,14 +444,16 @@ if(NOT CHAMELEON_SIMULATION)
         if (MPI_C_FOUND)
             message("-- ${Blue}Add definition CHAMELEON_USE_MPI"
             " - Activate MPI in Chameleon${ColourReset}")
-            set(CHAMELEON_USE_MPI 1)
             list(APPEND EXTRA_LIBRARIES ${MPI_C_LIBRARIES} )
             include_directories( ${MPI_C_INCLUDE_PATH} )
             # tests for intel mpi
             #list(APPEND MPI_C_COMPILE_FLAGS "-mt_mpi")
             #list(APPEND MPI_COMPILE_FLAGS "-mt_mpi")
+            if(MPI_C_COMPILE_FLAGS)
+                set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MPI_C_COMPILE_FLAGS}")
+            endif()
             if(MPI_C_LINK_FLAGS)
-                list(APPEND CMAKE_EXE_LINKER_FLAGS "${MPI_C_LINK_FLAGS}")
+                set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MPI_C_LINK_FLAGS}")
             endif()
         endif (MPI_C_FOUND)
 
@@ -517,7 +473,6 @@ else (NOT CHAMELEON_SIMULATION)
 
     message("-- ${Blue}Add definition CHAMELEON_SIMULATION"
     " - Activate simulation mode in Chameleon (to use with StarPU+SimGrid)${ColourReset}")
-    set(CHAMELEON_SIMULATION 1)
 
     add_subdirectory(simucore)
 
@@ -532,11 +487,6 @@ else (NOT CHAMELEON_SIMULATION)
         "${ColourReset}")
     endif()
 
-    # Add CUDA definition if required
-    if (CHAMELEON_USE_CUDA)
-        set(CHAMELEON_USE_CUDA 1)
-    endif()
-
     if (NOT CHAMELEON_SCHED_STARPU)
         message(FATAL_ERROR "Simulation mode of Chameleon only works with"
         "\n   the StarPU runtime. Please use CHAMELEON_SCHED_STARPU=ON.")
@@ -599,11 +549,13 @@ else (NOT CHAMELEON_SIMULATION)
         if (MPI_C_FOUND)
             message("-- ${Blue}Add definition CHAMELEON_USE_MPI"
             " - Activate MPI in Chameleon${ColourReset}")
-            set(CHAMELEON_USE_MPI 1)
             list(APPEND EXTRA_LIBRARIES ${MPI_C_LIBRARIES} )
             include_directories( ${MPI_C_INCLUDE_PATH} )
+            if(MPI_C_COMPILE_FLAGS)
+                set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MPI_C_COMPILE_FLAGS}")
+            endif()
             if(MPI_C_LINK_FLAGS)
-                list(APPEND CMAKE_EXE_LINKER_FLAGS "${MPI_C_LINK_FLAGS}")
+                set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MPI_C_LINK_FLAGS}")
             endif()
         endif (MPI_C_FOUND)
 
@@ -641,20 +593,24 @@ if( CHAMELEON_SCHED_STARPU )
     if ( STARPU_FOUND )
         message("-- ${Blue}Add definition CHAMELEON_SCHED_STARPU"
         " - Activate StarPU in Chameleon${ColourReset}")
-        set(CHAMELEON_SCHED_STARPU 1)
-        include_directories(${STARPU_INCLUDE_DIRS_DEP})
-        if(STARPU_LINKER_FLAGS)
-            list(APPEND CMAKE_EXE_LINKER_FLAGS "${STARPU_LINKER_FLAGS}")
+        if (STARPU_INCLUDE_DIRS_DEP)
+            include_directories(${STARPU_INCLUDE_DIRS_DEP})
+            set(CMAKE_REQUIRED_INCLUDES "${STARPU_INCLUDE_DIRS_DEP}")
         endif()
-        set(CMAKE_REQUIRED_INCLUDES "${STARPU_INCLUDE_DIRS_DEP}")
-        foreach(libdir ${STARPU_LIBRARY_DIRS_DEP})
-            list(APPEND CMAKE_REQUIRED_FLAGS "-L${libdir}")
-        endforeach()
-        set(CMAKE_REQUIRED_LIBRARIES "${STARPU_LIBRARIES_DEP}")
-        if (CHAMELEON_USE_MPI)
-            list(APPEND CMAKE_REQUIRED_INCLUDES "${MPI_C_INCLUDE_PATH}")
-            list(APPEND CMAKE_REQUIRED_FLAGS "${MPI_C_LINK_FLAGS}")
-            list(APPEND CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}")
+        if(STARPU_CFLAGS_OTHER_DEP)
+            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${STARPU_CFLAGS_OTHER_DEP}")
+            set(CMAKE_REQUIRED_FLAGS "${STARPU_CFLAGS_OTHER_DEP}")
+        endif()
+        if(STARPU_LDFLAGS_OTHER_DEP)
+            set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${STARPU_LDFLAGS_OTHER_DEP}")
+            set(CMAKE_REQUIRED_LDFLAGS "${STARPU_LDFLAGS_OTHER_DEP}")
+        endif()
+        if(STARPU_LIBRARY_DIRS_DEP)
+            list(APPEND CMAKE_INSTALL_RPATH "${STARPU_LIBRARY_DIRS_DEP}")
+        endif()
+        if (STARPU_LIBRARIES_DEP)
+            list(INSERT CHAMELEON_DEP 0 ${STARPU_LIBRARIES_DEP})
+            set(CMAKE_REQUIRED_LIBRARIES "${STARPU_LIBRARIES_DEP}")
         endif()
         if (CHAMELEON_SIMULATION)
             list(APPEND CMAKE_REQUIRED_FLAGS "-include" "starpu_simgrid_wrap.h")
@@ -678,7 +634,6 @@ if( CHAMELEON_SCHED_STARPU )
         endif()
         check_function_exists(starpu_malloc_on_node_set_default_flags HAVE_STARPU_MALLOC_ON_NODE_SET_DEFAULT_FLAGS)
         if ( HAVE_STARPU_MALLOC_ON_NODE_SET_DEFAULT_FLAGS )
-            set(HAVE_STARPU_MALLOC_ON_NODE_SET_DEFAULT_FLAGS 1)
             message("-- ${Blue}Add definition HAVE_STARPU_MALLOC_ON_NODE_SET_DEFAULT_FLAGS${ColourReset}")
         endif()
         check_function_exists(starpu_mpi_data_migrate HAVE_STARPU_MPI_DATA_MIGRATE)
@@ -721,32 +676,6 @@ if( CHAMELEON_SCHED_STARPU )
                 message("-- ${Blue}Add definition HAVE_STARPU_MPI_COMM_GET_ATTR${ColourReset}")
             endif()
         endif()
-        if(HWLOC_FOUND AND HWLOC_LIBRARY_DIRS)
-            # the RPATH to be used when installing
-            list(APPEND CMAKE_INSTALL_RPATH "${HWLOC_LIBRARY_DIRS}")
-        endif()
-        if(FXT_FOUND AND FXT_LIBRARY_DIRS)
-            # the RPATH to be used when installing
-            list(APPEND CMAKE_INSTALL_RPATH "${FXT_LIBRARY_DIRS}")
-        endif()
-        if(SIMGRID_FOUND AND SIMGRID_LIBRARY_DIRS)
-            # the RPATH to be used when installing
-            list(APPEND CMAKE_INSTALL_RPATH "${SIMGRID_LIBRARY_DIRS}")
-        endif()
-        if(STARPU_FOUND AND STARPU_LIBRARY_DIRS)
-            # the RPATH to be used when installing
-            list(APPEND CMAKE_INSTALL_RPATH "${STARPU_LIBRARY_DIRS}")
-        endif()
-        if (STARPU_LIBRARIES)
-            if (STARPU_LIBRARIES_DEP)
-                list(INSERT CHAMELEON_DEP 0 ${STARPU_LIBRARIES_DEP})
-            else()
-                list(INSERT CHAMELEON_DEP 0 ${STARPU_LIBRARIES})
-            endif()
-        endif()
-        unset(CMAKE_REQUIRED_FLAGS)
-        unset(CMAKE_REQUIRED_INCLUDES)
-        unset(CMAKE_REQUIRED_LIBRARIES)
     else ( STARPU_FOUND )
         if(MORSE_VERBOSE_FIND_PACKAGE)
             if(NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES)
@@ -825,46 +754,32 @@ if( CHAMELEON_SCHED_PARSEC )
     #if(CHAMELEON_WITH_PROFILING)
     #    list(APPEND PARSEC_COMPONENT_LIST "PAPI")
     #endif()
-
     find_package(PARSEC COMPONENTS ${PARSEC_COMPONENT_LIST})
-
-    # Add definition and include_dir if found
     if(PARSEC_FOUND)
         message("-- ${Blue}Add definition CHAMELEON_SCHED_PARSEC"
         " - Activate PaRSEC in Chameleon${ColourReset}")
-
-      set(CHAMELEON_SCHED_PARSEC 1)
-      include_directories(${PARSEC_INCLUDE_DIRS_DEP})
-      include_directories(${PARSEC_INCLUDE_DIRS}/daguepp)
-      set(CMAKE_REQUIRED_INCLUDES "${PARSEC_INCLUDE_DIRS_DEP}")
-
-      if(PARSEC_LINKER_FLAGS)
-           list(APPEND CMAKE_EXE_LINKER_FLAGS "${PARSEC_LINKER_FLAGS}")
+      if (PARSEC_INCLUDE_DIRS_DEP)
+          include_directories(${PARSEC_INCLUDE_DIRS_DEP})
       endif()
-      foreach(libdir ${PARSEC_LIBRARY_DIRS_DEP})
-          list(APPEND CMAKE_REQUIRED_FLAGS "-L${libdir}")
-      endforeach()
-      string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
-      set(CMAKE_REQUIRED_LIBRARIES "${PARSEC_LIBRARIES_DEP}")
-
-      if(HWLOC_FOUND AND HWLOC_LIBRARY_DIRS)
-            # the RPATH to be used when installing
-          list(APPEND CMAKE_INSTALL_RPATH "${HWLOC_LIBRARY_DIRS}")
+      if(PARSEC_CFLAGS_OTHER_DEP)
+          set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PARSEC_CFLAGS_OTHER_DEP}")
       endif()
-      if(PARSEC_FOUND AND PARSEC_LIBRARY_DIRS_DEP)
-          # the RPATH to be used when installing
+      if(PARSEC_LDFLAGS_OTHER_DEP)
+          set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PARSEC_LDFLAGS_OTHER_DEP}")
+      endif()
+      if(PARSEC_LIBRARY_DIRS_DEP)
           list(APPEND CMAKE_INSTALL_RPATH "${PARSEC_LIBRARY_DIRS_DEP}")
       endif()
-      if (PARSEC_LIBRARIES)
-          if (PARSEC_LIBRARIES_DEP)
-              list(INSERT CHAMELEON_DEP 0 ${PARSEC_LIBRARIES_DEP})
-          else()
-              list(INSERT CHAMELEON_DEP 0 ${PARSEC_LIBRARIES})
-          endif()
+      if (PARSEC_LIBRARIES_DEP)
+          list(INSERT CHAMELEON_DEP 0 ${PARSEC_LIBRARIES_DEP})
       endif()
-      unset(CMAKE_REQUIRED_FLAGS)
-      unset(CMAKE_REQUIRED_INCLUDES)
-      unset(CMAKE_REQUIRED_LIBRARIES)
+      string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+      # to test if symbols exist, e.g.
+      # set(CMAKE_REQUIRED_INCLUDES "${PARSEC_INCLUDE_DIRS_DEP}")
+      # set(CMAKE_REQUIRED_FLAGS "${PARSEC_CFLAGS_OTHER_DEP}")
+      # set(CMAKE_REQUIRED_LDFLAGS "${PARSEC_LDFLAGS_OTHER_DEP}")
+      # set(CMAKE_REQUIRED_LIBRARIES "${PARSEC_LIBRARIES_DEP}")
+      # check_function_exists(parsec_init HAVE_PARSEC_INIT)
     else ( PARSEC_FOUND )
         if(MORSE_VERBOSE_FIND_PACKAGE)
             if(NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES)
@@ -912,18 +827,20 @@ if( CHAMELEON_SCHED_QUARK )
     if(QUARK_FOUND)
         message("-- ${Blue}Add definition CHAMELEON_SCHED_QUARK"
         " - Activate QUARK in Chameleon${ColourReset}")
-        set(CHAMELEON_SCHED_QUARK 1)
-        include_directories(${QUARK_INCLUDE_DIRS})
-        if(QUARK_LIBRARY_DIRS)
-            # the RPATH to be used when installing
-            list(APPEND CMAKE_INSTALL_RPATH "${QUARK_LIBRARY_DIRS}")
+        if (QUARK_INCLUDE_DIRS_DEP)
+            include_directories(${QUARK_INCLUDE_DIRS_DEP})
         endif()
-        if (QUARK_LIBRARIES)
-            if (QUARK_LIBRARIES_DEP)
-                list(INSERT CHAMELEON_DEP 0 ${QUARK_LIBRARIES_DEP})
-            else()
-                list(INSERT CHAMELEON_DEP 0 ${QUARK_LIBRARIES})
-            endif()
+        if(QUARK_CFLAGS_OTHER_DEP)
+            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${QUARK_CFLAGS_OTHER_DEP}")
+        endif()
+        if(QUARK_LDFLAGS_OTHER_DEP)
+            set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${QUARK_LDFLAGS_OTHER_DEP}")
+        endif()
+        if(QUARK_LIBRARY_DIRS_DEP)
+            list(APPEND CMAKE_INSTALL_RPATH "${QUARK_LIBRARY_DIRS_DEP}")
+        endif()
+        if (QUARK_LIBRARIES_DEP)
+            list(INSERT CHAMELEON_DEP 0 ${QUARK_LIBRARIES_DEP})
         endif()
     else(QUARK_FOUND)
         if(MORSE_VERBOSE_FIND_PACKAGE)
@@ -965,6 +882,8 @@ cmake_dependent_option(CHAMELEON_USE_CUBLAS_V2
   "Enable cublas API v2" ON
   "CHAMELEON_USE_CUDA;CHAMELEON_SCHED_STARPU" OFF)
 
+list(REMOVE_DUPLICATES CMAKE_C_FLAGS)
+string(REPLACE ";" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
 list(REMOVE_DUPLICATES CMAKE_EXE_LINKER_FLAGS)
 string(REPLACE ";" " " CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
 # Fix a problem on Mac OS X when building shared libraries
@@ -972,23 +891,32 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
     set(CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup")
 endif()
 
-#------------------------------------------------------------------------------
-if(CHAMELEON_SCHED_STARPU)
-    link_directories(${STARPU_LIBRARY_DIRS_DEP})
-elseif(CHAMELEON_SCHED_PARSEC)
-    link_directories(${PARSEC_LIBRARY_DIRS_DEP})
-elseif(CHAMELEON_SCHED_QUARK)
-    link_directories(${QUARK_LIBRARY_DIRS})
-endif()
-if(NOT CHAMELEON_SIMULATION)
-    if(CHAMELEON_USE_CUDA)
-        link_directories(${CUDA_LIBRARY_DIRS})
-    endif()
-endif()
-
 # Save extra dependencies (all required links)
 list(APPEND CHAMELEON_DEP ${EXTRA_LIBRARIES})
-list(REMOVE_DUPLICATES CHAMELEON_DEP) # WARNING: is it safe, respect order?
+# We remove duplicate dependencies ensuring that redundant libraries are placed last
+list(REVERSE CHAMELEON_DEP)
+list(REMOVE_DUPLICATES CHAMELEON_DEP)
+list(REVERSE CHAMELEON_DEP)
+
+# we add chameleon's own library
+set(CHAMELEON_LIBRARIES "chameleon")
+if (NOT CHAMELEON_SIMULATION)
+  list(APPEND CHAMELEON_LIBRARIES coreblas)
+  if (CHAMELEON_USE_CUDA)
+    list(APPEND CHAMELEON_LIBRARIES cudablas)
+  endif()
+endif()
+if (CHAMELEON_SCHED_QUARK)
+  list(APPEND CHAMELEON_LIBRARIES chameleon_quark)
+endif()
+if (CHAMELEON_SCHED_PARSEC)
+  list(APPEND CHAMELEON_LIBRARIES chameleon_parsec)
+endif()
+if (CHAMELEON_SCHED_STARPU)
+  list(APPEND CHAMELEON_LIBRARIES chameleon_starpu)
+endif()
+list(APPEND CHAMELEON_LIBRARIES hqr)
+set(CHAMELEON_LIBRARIES_DEP ${CHAMELEON_LIBRARIES} ${CHAMELEON_DEP})
 
 # Check for the subdirectories
 # ----------------------------
@@ -1021,12 +949,6 @@ if (NOT CHAMELEON_SIMULATION)
 
 endif()
 
-###############################################################################
-# Add HQR library #
-###################
-add_subdirectory(hqr)
-include_directories(hqr/include)
-
 ###############################################################################
 # Main library #
 ################
diff --git a/cmake_modules/GenPkgConfig.cmake b/cmake_modules/GenPkgConfig.cmake
index 99b06b7cd5a554d6edf4bc5bd53db40579c14889..b4d2429e406344377e4178baf9b6357b08ee8fb3 100644
--- a/cmake_modules/GenPkgConfig.cmake
+++ b/cmake_modules/GenPkgConfig.cmake
@@ -110,9 +110,9 @@ MACRO(GENERATE_PKGCONFIG_FILE)
     if(CHAMELEON_SCHED_STARPU)
         list(APPEND CHAMELEON_PKGCONFIG_LIBS -lchameleon_starpu)
         if ( CHAMELEON_USE_MPI )
-            list(APPEND CHAMELEON_PKGCONFIG_REQUIRED_PRIVATE libstarpumpi)
+            list(APPEND CHAMELEON_PKGCONFIG_REQUIRED_PRIVATE starpumpi-${STARPU_VERSION})
         else()
-            list(APPEND CHAMELEON_PKGCONFIG_REQUIRED_PRIVATE libstarpu)
+            list(APPEND CHAMELEON_PKGCONFIG_REQUIRED_PRIVATE starpu-${STARPU_VERSION})
         endif()
     elseif(CHAMELEON_SCHED_QUARK)
         list(APPEND CHAMELEON_PKGCONFIG_LIBS -lchameleon_quark)
@@ -131,7 +131,7 @@ MACRO(GENERATE_PKGCONFIG_FILE)
         list(APPEND CHAMELEON_PKGCONFIG_REQUIRED "coreblas")
 
         if(CHAMELEON_USE_CUDA)
-            list(APPEND CUDABLAS_PKGCONFIG_LIBS_PRIVATE ${CUDA_LIBRARIES})
+            list(APPEND CUDABLAS_PKGCONFIG_LIBS_PRIVATE ${EXTRA_LIBRARIES_CUDA})
             list(APPEND CHAMELEON_PKGCONFIG_REQUIRED "cudablas")
         endif()
 
diff --git a/cmake_modules/PrintOpts.cmake b/cmake_modules/PrintOpts.cmake
index 8a4886cf48dccbf08ddfd36eb114a85257a68c8c..5a1051a68fdfdda375fa72555a08761c55372d47 100644
--- a/cmake_modules/PrintOpts.cmake
+++ b/cmake_modules/PrintOpts.cmake
@@ -4,7 +4,7 @@
 #
 # @copyright 2009-2014 The University of Tennessee and The University of
 #                      Tennessee Research Foundation. All rights reserved.
-# @copyright 2012-2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
+# @copyright 2012-2018 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
 #                      Univ. Bordeaux. All rights reserved.
 #
 ###
@@ -22,6 +22,7 @@
 #  @date 2014-11-10
 #
 ###
+
 set(dep_message "\nConfiguration of Chameleon:\n"
         "       BUILDNAME ...........: ${BUILDNAME}\n"
         "       SITE ................: ${SITE}\n"
@@ -40,14 +41,16 @@ set(dep_message "${dep_message}"
 "       Build shared ........: ${BUILD_SHARED_LIBS}\n"
 "       CFlags ..............: ${CMAKE_C_FLAGS}\n"
 "       LDFlags .............: ${CMAKE_C_LINK_FLAGS}\n"
+"       EXE LDFlags .........: ${CMAKE_EXE_LINKER_FLAGS}\n"
 "\n"
 "       Implementation paradigm\n"
 "       CUDA ................: ${CHAMELEON_USE_CUDA}\n"
 "       MPI .................: ${CHAMELEON_USE_MPI}\n"
 "\n"
 "       Runtime specific\n"
+"       PARSEC ..............: ${CHAMELEON_SCHED_PARSEC}\n"
 "       QUARK ...............: ${CHAMELEON_SCHED_QUARK}\n"
-"       StarPU ..............: ${CHAMELEON_SCHED_STARPU}\n"
+"       STARPU ..............: ${CHAMELEON_SCHED_STARPU}\n"
 "\n"
 "       Kernels specific\n"
 "       BLAS ................: ${BLAS_VENDOR_FOUND}\n"
@@ -63,7 +66,7 @@ set(dep_message "${dep_message}"
 "       timing ...............: ${CHAMELEON_ENABLE_TIMING}\n"
 "\n"
 "       CHAMELEON dependencies :\n")
-foreach (_dep ${CHAMELEON_DEP})
+foreach (_dep ${CHAMELEON_LIBRARIES_DEP})
     set(dep_message "${dep_message}"
     "                                 ${_dep}\n")
 endforeach ()
diff --git a/cmake_modules/morse_cmake b/cmake_modules/morse_cmake
index 3f67955ffafb59534a77f80e61776e7b8a850c32..41874844df7b3327b5ea71e983c9d9471f31eeec 160000
--- a/cmake_modules/morse_cmake
+++ b/cmake_modules/morse_cmake
@@ -1 +1 @@
-Subproject commit 3f67955ffafb59534a77f80e61776e7b8a850c32
+Subproject commit 41874844df7b3327b5ea71e983c9d9471f31eeec
diff --git a/compute/CMakeLists.txt b/compute/CMakeLists.txt
index 58d639f5fe4952f1a83dab0f7d0d06a1abf4ac9d..6a9932cb5fa0f5e47511e58e88bf54a71334e5bf 100644
--- a/compute/CMakeLists.txt
+++ b/compute/CMakeLists.txt
@@ -294,21 +294,17 @@ set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};chameleon_sources" C
 add_library(chameleon ${CHAMELEON_SRCS} ${CHAMELEON_SRCSF})
 if(CHAMELEON_SCHED_STARPU)
   target_link_libraries(chameleon chameleon_starpu)
-  list(INSERT CHAMELEON_DEP 0 -lchameleon_starpu)
 elseif(CHAMELEON_SCHED_PARSEC)
   target_link_libraries(chameleon chameleon_parsec)
-  list(INSERT CHAMELEON_DEP 0 -lchameleon_parsec)
 elseif(CHAMELEON_SCHED_QUARK)
   target_link_libraries(chameleon chameleon_quark)
-  list(INSERT CHAMELEON_DEP 0 -lchameleon_quark)
 endif()
 if (NOT CHAMELEON_SIMULATION)
-  add_dependencies(chameleon
-    coreblas_include)
+  # Depends on coreblas only for set_coreblas_gemm3m_enabled() (Maybe we should change that)
+  add_dependencies(chameleon coreblas_include)
   target_link_libraries(chameleon coreblas)
 endif()
 target_link_libraries(chameleon hqr)
-list(INSERT CHAMELEON_DEP 0 -lchameleon)
 
 add_dependencies(chameleon
   chameleon_include
diff --git a/coreblas/compute/CMakeLists.txt b/coreblas/compute/CMakeLists.txt
index 0b406e71fcb7b1eb4580ed78d07ae53665ffca09..ddae10cf13bd9db29c3f415700ade8629bf0a164 100644
--- a/coreblas/compute/CMakeLists.txt
+++ b/coreblas/compute/CMakeLists.txt
@@ -114,16 +114,13 @@ set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};coreblas_sources" CA
 # Compile step
 # ------------
 add_library(coreblas ${COREBLAS_SRCS})
-list(INSERT CHAMELEON_DEP 0 -lcoreblas)
 add_dependencies(coreblas coreblas_include coreblas_sources)
 set_property(TARGET coreblas PROPERTY LINKER_LANGUAGE Fortran)
 set_property(TARGET coreblas PROPERTY INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
 
 target_link_libraries(coreblas
-  ${LAPACKE_LIBRARIES}
-  ${LAPACK_SEQ_LIBRARIES}
-  ${CBLAS_LIBRARIES}
-  ${BLAS_SEQ_LIBRARIES}
+  ${LAPACKE_LIBRARIES_DEP}
+  ${CBLAS_LIBRARIES_DEP}
   )
 
 # Installation
diff --git a/coreblas/eztrace_module/CMakeLists.txt b/coreblas/eztrace_module/CMakeLists.txt
index 322d0f0913520cdf7580764425e598f4da2844a1..5ae5c17175209a5c32a9c6c1cf96403d8978de04 100644
--- a/coreblas/eztrace_module/CMakeLists.txt
+++ b/coreblas/eztrace_module/CMakeLists.txt
@@ -33,6 +33,7 @@ if (EZTRACE_FOUND AND EZTRACE_DIR_FOUND)
     find_path(EZTRACE_eztrace_create_plugin_DIR
       NAMES eztrace_create_plugin
       HINTS ${EZTRACE_DIR_FOUND}/bin)
+    mark_as_advanced(EZTRACE_eztrace_create_plugin_DIR)
 
     if (EZTRACE_eztrace_create_plugin_DIR)
 
diff --git a/cudablas/compute/CMakeLists.txt b/cudablas/compute/CMakeLists.txt
index 017c118c03f1fd9602e1ae89a48fce9b0f378743..209bf5b37330194e4b34d7139dc37a8b5687866e 100644
--- a/cudablas/compute/CMakeLists.txt
+++ b/cudablas/compute/CMakeLists.txt
@@ -102,7 +102,7 @@ set_property(TARGET cudablas PROPERTY INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/
 
 target_link_libraries(cudablas
   coreblas
-  ${CUDA_LIBRARIES})
+  ${EXTRA_LIBRARIES_CUDA})
 
 # installation
 # ------------
diff --git a/cudablas/eztrace_module/CMakeLists.txt b/cudablas/eztrace_module/CMakeLists.txt
index 702ca4b8bec07ee5f42c8e2a2bf0dd7d06f2fe8b..01eb745e21a78f5c782714743a5c20b7406d5024 100644
--- a/cudablas/eztrace_module/CMakeLists.txt
+++ b/cudablas/eztrace_module/CMakeLists.txt
@@ -33,6 +33,7 @@ if (EZTRACE_FOUND AND EZTRACE_DIR_FOUND)
     find_path(EZTRACE_eztrace_create_plugin_DIR
       NAMES eztrace_create_plugin
       HINTS ${EZTRACE_DIR_FOUND}/bin)
+    mark_as_advanced(EZTRACE_eztrace_create_plugin_DIR)
 
     if (EZTRACE_eztrace_create_plugin_DIR)
 
diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
index 0d3b264e0ee4b9bb1c1649d6671a30fab46c1b44..3aac1b739165df755bad3785644b994d295065d6 100755
--- a/example/CMakeLists.txt
+++ b/example/CMakeLists.txt
@@ -24,8 +24,6 @@ if (CHAMELEON_SIMULATION)
   message(ERROR "example directory should not be included when simulation is enabled")
 endif()
 
-add_subdirectory(basic_zposv)
-
 if (CHAMELEON_PREC_D)
     add_subdirectory(lapack_to_morse)
     if (CHAMELEON_SCHED_STARPU)
diff --git a/example/basic_zposv/CMakeLists.txt b/example/basic_zposv/CMakeLists.txt
deleted file mode 100644
index 945dbdc135b3c597e43ce57a257dbfbd39de318e..0000000000000000000000000000000000000000
--- a/example/basic_zposv/CMakeLists.txt
+++ /dev/null
@@ -1,105 +0,0 @@
-###
-#
-# @file CMakeLists.txt
-#
-# @copyright 2009-2014 The University of Tennessee and The University of
-#                      Tennessee Research Foundation. All rights reserved.
-# @copyright 2012-2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
-#                      Univ. Bordeaux. All rights reserved.
-#
-###
-#
-#  MORSE example routines
-#  MORSE is a software package provided by Inria Bordeaux - Sud-Ouest, LaBRI,
-#  University of Bordeaux, Bordeaux INP
-#
-# @version 1.0.0
-#  @author Florent Pruvost
-#  @date 2014-10-13
-#
-###
-
-set(EXAMPLES_HDR
-    basic_posv.h
-    posv_morse_functions.h
-    posv_users_functions.h
-   )
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
-include_directories(${CMAKE_CURRENT_SOURCE_DIR})
-
-# Generate the morse testing sources for all possible precisions
-# --------------------------------------------------------------
-set(EXAMPLES "")
-set(ZSRC
-    zposv_morse_functions.c
-    zposv_users_functions.c
-   )
-
-precisions_rules_py(EXAMPLES "${ZSRC}"
-                    PRECISIONS "${CHAMELEON_PRECISION}")
-
-# Define what libraries we have to link with
-# ------------------------------------------
-unset(libs_for_examples)
-list(APPEND libs_for_examples
-     chameleon
-)
-
-if(CHAMELEON_SCHED_STARPU)
-    list(APPEND libs_for_examples
-      chameleon_starpu
-      ${STARPU_LIBRARIES_DEP}
-    )
-    link_directories(${STARPU_LIBRARY_DIRS})
-elseif(CHAMELEON_SCHED_PARSEC)
-    list(APPEND libs_for_examples
-         chameleon_parsec
-         ${PARSEC_LIBRARIES_DEP}
-      )
-    link_directories(${PARSEC_LIBRARY_DIRS_DEP})
-elseif(CHAMELEON_SCHED_QUARK)
-    list(APPEND libs_for_examples
-         chameleon_quark
-         ${QUARK_LIBRARIES}
-      )
-    link_directories(${QUARK_LIBRARY_DIRS})
-endif()
-
-if(CHAMELEON_USE_CUDA)
-  list(APPEND libs_for_examples
-    cudablas)
-endif()
-if(CHAMELEON_USE_CUDA)
-  link_directories(${CUDA_LIBRARY_DIRS})
-endif()
-
-list(APPEND libs_for_examples
-  coreblas
-  ${LAPACKE_LIBRARIES}
-  ${CBLAS_LIBRARIES}
-  ${LAPACK_SEQ_LIBRARIES}
-  ${BLAS_SEQ_LIBRARIES}
-  ${EXTRA_LIBRARIES}
-  )
-
-link_directories(${LAPACKE_LIBRARY_DIRS})
-link_directories(${LAPACK_LIBRARY_DIRS})
-link_directories(${CBLAS_LIBRARY_DIRS})
-link_directories(${BLAS_LIBRARY_DIRS})
-
-# message(STATUS "libs timings: ${libs_for_examples}")
-foreach(_example ${EXAMPLES})
-    get_filename_component(_name_exe ${_example} NAME_WE)
-    add_executable(${_name_exe} ${_example})
-    set_property(TARGET ${_name_exe} PROPERTY LINKER_LANGUAGE Fortran)
-    target_link_libraries(${_name_exe} ${libs_for_examples})
-    install(TARGETS ${_name_exe}
-            DESTINATION bin/example/basic_zposv )
-endforeach()
-
-#-------- Tests ---------
-include(CTestLists.cmake)
-
-###
-### END CMakeLists.txt
-###
diff --git a/example/basic_zposv/CTestLists.cmake b/example/basic_zposv/CTestLists.cmake
deleted file mode 100644
index 1bbb1e46de8a23e620e9258d55bb499e448ae7a7..0000000000000000000000000000000000000000
--- a/example/basic_zposv/CTestLists.cmake
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Check Example basic_zposv
-#
-
-set(TESTLIST
-    posv_morse_functions
-    posv_users_functions
-    )
-
-foreach(prec ${RP_CHAMELEON_PRECISIONS})
-    string(TOUPPER ${prec} PREC)
-    if (CHAMELEON_PREC_${PREC})
-        foreach(test ${TESTLIST})
-            add_test(example_basic_${prec}${test} ./${prec}${test})
-        endforeach()
-    endif()
-endforeach()
\ No newline at end of file
diff --git a/example/basic_zposv/basic_posv.h b/example/basic_zposv/basic_posv.h
deleted file mode 100644
index 5f7aa0dc06ece32f9e856083439ab7cf035f7cb7..0000000000000000000000000000000000000000
--- a/example/basic_zposv/basic_posv.h
+++ /dev/null
@@ -1,240 +0,0 @@
-/**
- *
- * @file basic_posv.h
- *
- * @copyright 2009-2014 The University of Tennessee and The University of
- *                      Tennessee Research Foundation. All rights reserved.
- * @copyright 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
- *                      Univ. Bordeaux. All rights reserved.
- *
- ***
- *
- * @brief Chameleon basic_posv example header
- *
- * @version 1.0.0
- * @author Florent Pruvost
- * @date 2014-10-13
- *
- */
-#ifndef BASIC_POSV_H
-#define BASIC_POSV_H
-
-#if defined( _WIN32 ) || defined( _WIN64 )
-#define int64_t __int64
-#endif
-
-/* Define these so that the Microsoft VC compiler stops complaining
-   about scanf and friends */
-#define _CRT_SECURE_NO_DEPRECATE
-#define _CRT_SECURE_NO_WARNINGS
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#if defined( _WIN32 ) || defined( _WIN64 )
-#include <windows.h>
-#else  /* Non-Windows */
-#include <unistd.h>
-#include <sys/resource.h>
-#endif
-
-#include <coreblas/cblas.h>
-#include <coreblas/lapacke.h>
-#include <morse.h>
-#include <coreblas.h>
-
-#if defined(CHAMELEON_USE_MPI)
-#include <mpi.h>
-#endif
-
-static void
-show_help(char *prog_name) {
-    printf( "Usage:\n%s [options]\n\n", prog_name );
-    printf( "Options are:\n"
-            "  --help           Show this help\n"
-            "\n"
-            "  --threads=X      Number of CPU workers (default: _SC_NPROCESSORS_ONLN)\n"
-            "  --gpus=X         Number of GPU workers (default: 0)\n"
-            "\n"
-            "  --n=X            dimension (N) (default: 500)\n"
-            "  --nb=X           Nb size. (default: 128)\n"
-            "  --ib=X           IB size. (default: 32)\n"
-            "\n");
-}
-
-static void get_thread_count(int *thrdnbr) {
-#if defined WIN32 || defined WIN64
-    sscanf( getenv( "NUMBER_OF_PROCESSORS" ), "%d", thrdnbr );
-#else
-    *thrdnbr = sysconf(_SC_NPROCESSORS_ONLN);
-#endif
-}
-
-static int startswith(const char *s, const char *prefix) {
-    size_t n = strlen( prefix );
-    if (strncmp( s, prefix, n ))
-        return 0;
-    return 1;
-}
-
-enum iparam_examples {
-    IPARAM_THRDNBR,        /* Number of cores                            */
-    IPARAM_THRDNBR_SUBGRP, /* Number of cores in a subgroup (NUMA node)  */
-    IPARAM_SCHEDULER,      /* What scheduler do we choose (dyn, stat)    */
-    IPARAM_M,              /* Number of rows of the matrix               */
-    IPARAM_N,              /* Number of columns of the matrix            */
-    IPARAM_K,              /* RHS or K                                   */
-    IPARAM_LDA,            /* Leading dimension of A                     */
-    IPARAM_LDB,            /* Leading dimension of B                     */
-    IPARAM_LDC,            /* Leading dimension of C                     */
-    IPARAM_IB,             /* Inner-blocking size                        */
-    IPARAM_NB,             /* Number of columns in a tile                */
-    IPARAM_MB,             /* Number of rows in a tile                   */
-    IPARAM_UPLO,           /* Consider upper or lower part of sym. mat.  */
-    IPARAM_NITER,          /* Number of iteration of each test           */
-    IPARAM_WARMUP,         /* Run one test to load dynamic libraries     */
-    IPARAM_CHECK,          /* Checking activated or not                  */
-    IPARAM_VERBOSE,        /* How much noise do we want?                 */
-    IPARAM_AUTOTUNING,     /* Disable/enable autotuning                  */
-    IPARAM_INPUTFMT,       /* Input format (Use only for getmi/gecfi)    */
-    IPARAM_OUTPUTFMT,      /* Output format (Use only for getmi/gecfi)   */
-    IPARAM_TRACE,          /* Generate trace on the first non warmup run */
-    IPARAM_DAG,            /* Do we require to output the DOT file?      */
-    IPARAM_ASYNC,          /* Asynchronous calls                         */
-    IPARAM_MX,             /* */
-    IPARAM_NX,             /* */
-    IPARAM_RHBLK,          /* Householder reduction parameter for QR/LQ  */
-    IPARAM_INPLACE,        /* InPlace/OutOfPlace translation mode        */
-
-    IPARAM_INVERSE,
-    IPARAM_NCUDAS,
-    IPARAM_NMPI,
-    IPARAM_P,              /* Parameter for 2D cyclic distribution       */
-    IPARAM_Q,              /* Parameter for 2D cyclic distribution       */
-    /* Added for StarPU version */
-    IPARAM_PROFILE,
-    IPARAM_PRINT_ERRORS,
-    IPARAM_PARALLEL_TASKS,
-    IPARAM_NO_CPU,
-    IPARAM_BOUND,
-    /* End */
-    IPARAM_SIZEOF
-};
-
-enum dparam_examples {
-  IPARAM_TIME,
-  IPARAM_ANORM,
-  IPARAM_BNORM,
-  IPARAM_XNORM,
-  IPARAM_RNORM,
-  IPARAM_AinvNORM,
-  IPARAM_RES,
-  /* Begin section for hydra integration tool */
-  IPARAM_THRESHOLD_CHECK, /* Maximum value accepted for: |Ax-b||/N/eps/(||A||||x||+||b||) */
-  /* End section for hydra integration tool  */
-  IPARAM_DNBPARAM
-};
-
-static void init_iparam(int iparam[IPARAM_SIZEOF]){
-    iparam[IPARAM_THRDNBR       ] = -1;
-    iparam[IPARAM_THRDNBR_SUBGRP] = 1;
-    iparam[IPARAM_SCHEDULER     ] = 0;
-    iparam[IPARAM_M             ] = -1;
-    iparam[IPARAM_N             ] = 500;
-    iparam[IPARAM_K             ] = 1;
-    iparam[IPARAM_LDA           ] = -1;
-    iparam[IPARAM_LDB           ] = -1;
-    iparam[IPARAM_LDC           ] = -1;
-    iparam[IPARAM_MB            ] = 128;
-    iparam[IPARAM_UPLO          ] = MorseUpper;
-    iparam[IPARAM_NB            ] = 128;
-    iparam[IPARAM_IB            ] = 32;
-    iparam[IPARAM_NITER         ] = 1;
-    iparam[IPARAM_WARMUP        ] = 1;
-    iparam[IPARAM_CHECK         ] = 0;
-    iparam[IPARAM_VERBOSE       ] = 0;
-    iparam[IPARAM_AUTOTUNING    ] = 0;
-    iparam[IPARAM_INPUTFMT      ] = 0;
-    iparam[IPARAM_OUTPUTFMT     ] = 0;
-    iparam[IPARAM_TRACE         ] = 0;
-    iparam[IPARAM_DAG           ] = 0;
-    iparam[IPARAM_ASYNC         ] = 1;
-    iparam[IPARAM_MX            ] = -1;
-    iparam[IPARAM_NX            ] = -1;
-    iparam[IPARAM_RHBLK         ] = 0;
-    iparam[IPARAM_MX            ] = -1;
-    iparam[IPARAM_NX            ] = -1;
-    iparam[IPARAM_RHBLK         ] = 0;
-    iparam[IPARAM_INPLACE       ] = MORSE_OUTOFPLACE;
-
-    iparam[IPARAM_INVERSE       ] = 0;
-    iparam[IPARAM_NCUDAS        ] = 0;
-    iparam[IPARAM_NMPI          ] = 1;
-    iparam[IPARAM_P             ] = 1;
-    iparam[IPARAM_Q             ] = 1;
-    iparam[IPARAM_PROFILE       ] = 0;
-    iparam[IPARAM_PRINT_ERRORS  ] = 0;
-    iparam[IPARAM_PARALLEL_TASKS] = 0;
-    iparam[IPARAM_NO_CPU        ] = 0;
-    iparam[IPARAM_BOUND         ] = 0;
-}
-
-static void read_args(int argc, char *argv[], int *iparam){
-    int i;
-    for (i = 1; i < argc && argv[i]; ++i) {
-        if ( startswith( argv[i], "--help") || startswith( argv[i], "-help") ||
-             startswith( argv[i], "--h") || startswith( argv[i], "-h") ) {
-            show_help( argv[0] );
-            exit(0);
-        } else if (startswith( argv[i], "--n=" )) {
-            sscanf( strchr( argv[i], '=' ) + 1, "%d", &(iparam[IPARAM_N]) );
-        } else if (startswith( argv[i], "--nb=" )) {
-            sscanf( strchr( argv[i], '=' ) + 1, "%d", &(iparam[IPARAM_NB]) );
-        } else if (startswith( argv[i], "--threads=" )) {
-            sscanf( strchr( argv[i], '=' ) + 1, "%d", &(iparam[IPARAM_THRDNBR]) );
-        } else if (startswith( argv[i], "--gpus=" )) {
-            sscanf( strchr( argv[i], '=' ) + 1, "%d", &(iparam[IPARAM_NCUDAS]) );
-        } else {
-            fprintf( stderr, "Unknown option: %s\n", argv[i] );
-        }
-    }
-}
-
-static void print_header(char *prog_name, int * iparam) {
-    const char *bound_header   = iparam[IPARAM_BOUND]   ? "   thGflop/s" : "";
-    const char *check_header   = iparam[IPARAM_CHECK]   ? "     ||Ax-b||       ||A||       ||x||       ||b|| ||Ax-b||/N/eps/(||A||||x||+||b||)  RETURN" : "";
-    const char *inverse_header = iparam[IPARAM_INVERSE] ? " ||I-A*Ainv||       ||A||    ||Ainv||       ||Id - A*Ainv||/((||A|| ||Ainv||).N.eps)" : "";
-#if defined(CHAMELEON_SIMULATION)
-    double    eps = 0.;
-#else
-    double    eps = LAPACKE_dlamch_work( 'e' );
-#endif
-
-    printf( "#\n"
-            "# CHAMELEON %d.%d.%d, %s\n"
-            "# Nb threads: %d\n"
-            "# Nb GPUs:    %d\n"
-            "# NB:         %d\n"
-            "# IB:         %d\n"
-            "# eps:        %e\n"
-            "#\n",
-            CHAMELEON_VERSION_MAJOR,
-            CHAMELEON_VERSION_MINOR,
-            CHAMELEON_VERSION_MICRO,
-            prog_name,
-            iparam[IPARAM_THRDNBR],
-            iparam[IPARAM_NCUDAS],
-            iparam[IPARAM_NB],
-            iparam[IPARAM_IB],
-            eps );
-
-    printf( "#     M       N  K/NRHS   seconds   Gflop/s Deviation%s%s\n",
-            bound_header, iparam[IPARAM_INVERSE] ? inverse_header : check_header);
-    printf( "# %5.0d   %5.0d   %5.0d\n", iparam[IPARAM_N], iparam[IPARAM_N], iparam[IPARAM_K]);
-    return;
-}
-
-#endif /* BASIC_POSV_H */
diff --git a/example/basic_zposv/posv_morse_functions.h b/example/basic_zposv/posv_morse_functions.h
deleted file mode 100644
index 794edd96277a12b7ea6bb42f228819ac1c4df7c0..0000000000000000000000000000000000000000
--- a/example/basic_zposv/posv_morse_functions.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- *
- * @file posv_morse_functions.h
- *
- * @copyright 2009-2014 The University of Tennessee and The University of
- *                      Tennessee Research Foundation. All rights reserved.
- * @copyright 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
- *                      Univ. Bordeaux. All rights reserved.
- *
- ***
- *
- * @brief Chameleon posv_morse_functions example header
- *
- * @version 1.0.0
- * @author Florent Pruvost
- * @date 2014-10-13
- *
- */
-#ifndef POSV_MORSE_FUNCTIONS_H
-#define POSV_MORSE_FUNCTIONS_H
-
-#include "basic_posv.h"
-
-#endif /* POSV_MORSE_FUNCTIONS_H */
diff --git a/example/basic_zposv/posv_users_functions.h b/example/basic_zposv/posv_users_functions.h
deleted file mode 100644
index 8d023dd13eceb5f8eefc711eec90ef4ea4572356..0000000000000000000000000000000000000000
--- a/example/basic_zposv/posv_users_functions.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- *
- * @file posv_users_functions.h
- *
- * @copyright 2009-2014 The University of Tennessee and The University of
- *                      Tennessee Research Foundation. All rights reserved.
- * @copyright 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
- *                      Univ. Bordeaux. All rights reserved.
- *
- ***
- *
- * @brief Chameleon posv_users_functions example header
- *
- * @version 1.0.0
- * @author Florent Pruvost
- * @date 2014-10-13
- *
- */
-#ifndef POSV_USERS_FUNCTIONS_H
-#define POSV_USERS_FUNCTIONS_H
-
-#include "basic_posv.h"
-
-/**
- *  Function to return address of block (m,n)
- */
-inline static void* user_getaddr_arrayofpointers(const MORSE_desc_t *A, int m, int n)
-{
-    MORSE_Complex64_t **matA = (MORSE_Complex64_t **)A->mat;
-    size_t mm = m + A->i / A->mb;
-    size_t nn = n + A->j / A->nb;
-    size_t offset = 0;
-
-#if defined(CHAMELEON_USE_MPI)
-    assert( A->myrank == A->get_rankof( A, mm, nn) );
-    mm = mm / A->p;
-    nn = nn / A->q;
-#endif
-
-    offset = A->mt*nn + mm;
-//    printf ("Array address in %d %d: %p\n", mm, nn, *(matA+(offset)));
-    return (void*)( *(matA + offset) );
-}
-
-/**
- *  Function to return the leading dimension of element A(m,*)
- */
-inline static int user_getblkldd_arrayofpointers(const MORSE_desc_t *A, int m)
-{
-    (void)m;
-    return A->mb;
-}
-
-/**
- *  Function to return MPI rank of element A(m,n)
- */
-inline static int user_getrankof_2d(const MORSE_desc_t *desc, int m, int n)
-{
-    return (m % desc->p) * desc->q + (n % desc->q);
-}
-
-#endif /* POSV_USERS_FUNCTIONS_H */
diff --git a/example/basic_zposv/zposv_morse_functions.c b/example/basic_zposv/zposv_morse_functions.c
deleted file mode 100644
index f676d2d3e3ce0ae65896914e616c62fd8018d53e..0000000000000000000000000000000000000000
--- a/example/basic_zposv/zposv_morse_functions.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- *
- * @file zposv_morse_functions.c
- *
- * @copyright 2009-2014 The University of Tennessee and The University of
- *                      Tennessee Research Foundation. All rights reserved.
- * @copyright 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
- *                      Univ. Bordeaux. All rights reserved.
- *
- ***
- *
- * @brief Chameleon zposv_morse_functions example
- *
- * @version 1.0.0
- * @author Florent Pruvost
- * @date 2014-10-13
- * @precisions normal z -> s d c
- *
- */
-#include "posv_morse_functions.h"
-
-int main(int argc, char *argv[]) {
-
-    int N, NB, NCPU, NCUDA;
-    MORSE_desc_t *descA = NULL, *descAC = NULL, *descB = NULL, *descX = NULL;
-
-    /* initialize some parameters with default values */
-    int iparam[IPARAM_SIZEOF];
-    memset(iparam, 0, IPARAM_SIZEOF*sizeof(int));
-    init_iparam(iparam);
-    iparam[IPARAM_UPLO] = MorseUpper;
-
-    /* read arguments */
-    read_args(argc, argv, iparam);
-    N  = iparam[IPARAM_N];
-    NB = iparam[IPARAM_NB];
-
-    /* initialize the number of thread if not given by the user in argv*/
-    if ( iparam[IPARAM_THRDNBR] == -1 ) {
-      get_thread_count( &(iparam[IPARAM_THRDNBR]) );
-      iparam[IPARAM_THRDNBR] -= iparam[IPARAM_NCUDAS];
-    }
-    NCPU  = iparam[IPARAM_THRDNBR];
-    NCUDA = iparam[IPARAM_NCUDAS];
-
-    printf("N, NB: %d %d\n", N, NB);
-    printf("NCPU, NCUDA: %d %d\n", NCPU, NCUDA);
-
-    /* initialize MORSE */
-    MORSE_Init( NCPU, NCUDA);
-    MORSE_Set(MORSE_TILE_SIZE,        NB );
-    MORSE_Set(MORSE_INNER_BLOCK_SIZE, iparam[IPARAM_IB] );
-
-    print_header( argv[0], iparam);
-
-    /*
-     * initialize the structure required for MORSE sequential task-based algorithms
-     * MORSE_desc_t is a structure wrapping your data allowing MORSE to get
-     * pointers to tiles
-     */
-    MORSE_Desc_Create(&descA, NULL, MorseComplexDouble,
-                      NB, NB, NB*NB, N, N, 0, 0, N, N, 1, 1);
-
-    /* generate A matrix with random values such that it is hermitian */
-    MORSE_zplghe_Tile( (double)N, MorseUpperLower, descA, 51 );
-
-    /* generate RHS */
-    MORSE_Desc_Create(&descB, NULL, MorseComplexDouble,
-                      NB, NB, NB*NB, N, 1, 0, 0, N, 1, 1, 1);
-    MORSE_zplrnt_Tile( descB, 7672 );
-
-    /* copy A before facto. in order to check the result */
-    MORSE_Desc_Create(&descAC, NULL, MorseComplexDouble,
-                      NB, NB, NB*NB, N, N, 0, 0, N, N, 1, 1);
-    MORSE_zlacpy_Tile(MorseUpperLower, descA, descAC);
-
-    /* copy B before solving in order to check the result */
-    MORSE_Desc_Create(&descX, NULL, MorseComplexDouble,
-                      NB, NB, NB*NB, N, 1, 0, 0, N, 1, 1, 1);
-    MORSE_zlacpy_Tile(MorseUpperLower, descB, descX);
-
-    /* solve the system AX = B using the Cholesky factorization,
-     * A is replaced by its factorization L or L^T depending on uplo
-     * B is stored in X on entry, X contains the result on exit */
-    MORSE_zposv_Tile(iparam[IPARAM_UPLO], descA, descX);
-    /* note that this call is equivalent to
-     * MORSE_zpotrf_Tile(uplo, descA) followed by
-     * MORSE_zpotrs_Tile(uplo, descA, descX )
-     * */
-
-    /* check if solve is correct i.e. AX-B = 0 */
-    /* compute norms to check the result */
-    double anorm = MORSE_zlange_Tile(MorseInfNorm, descAC);
-    double bnorm = MORSE_zlange_Tile(MorseInfNorm, descB);
-    double xnorm = MORSE_zlange_Tile(MorseInfNorm, descX);
-
-    /* compute A*X-B, store the result in B */
-    MORSE_zgemm_Tile( MorseNoTrans, MorseNoTrans, 1.0, descAC, descX, -1.0, descB );
-    double res = MORSE_zlange_Tile(MorseInfNorm, descB);
-
-    /* check residual and print a message */
-    #if defined(CHAMELEON_SIMULATION)
-    double    eps = 0.;
-    #else
-    double    eps = LAPACKE_dlamch_work( 'e' );
-    #endif
-    /*
-     * if hres = 0 then the test succeed
-     * else the test failed
-     */
-    int hres = 0;
-    hres = ( res / N / eps / (anorm * xnorm + bnorm ) > 100.0 );
-    printf( "   ||Ax-b||       ||A||       ||x||       ||b|| ||Ax-b||/N/eps/(||A||||x||+||b||)  RETURN\n");
-    if (hres)
-        printf( "%8.5e %8.5e %8.5e %8.5e                       %8.5e FAILURE \n",
-            res, anorm, xnorm, bnorm,
-            res / N / eps / (anorm * xnorm + bnorm ));
-    else
-        printf( "%8.5e %8.5e %8.5e %8.5e                       %8.5e SUCCESS \n",
-            res, anorm, xnorm, bnorm,
-            res / N / eps / (anorm * xnorm + bnorm ));
-
-    /* destroy MORSE specific structures */
-    MORSE_Desc_Destroy( &descX  );
-    MORSE_Desc_Destroy( &descB  );
-    MORSE_Desc_Destroy( &descAC );
-    MORSE_Desc_Destroy( &descA  );
-
-    /* Finalize MORSE */
-    MORSE_Finalize();
-
-    return EXIT_SUCCESS;
-}
-
diff --git a/example/basic_zposv/zposv_users_functions.c b/example/basic_zposv/zposv_users_functions.c
deleted file mode 100644
index e52593ae5137e2502d767182c99747a38755d9f0..0000000000000000000000000000000000000000
--- a/example/basic_zposv/zposv_users_functions.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/**
- *
- * @file zposv_users_functions.c
- *
- * @copyright 2009-2014 The University of Tennessee and The University of
- *                      Tennessee Research Foundation. All rights reserved.
- * @copyright 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
- *                      Univ. Bordeaux. All rights reserved.
- *
- ***
- *
- * @brief Chameleon zposv_users_functions example
- *
- * @version 1.0.0
- * @author Florent Pruvost
- * @date 2014-10-13
- * @precisions normal z -> s d c
- *
- */
-#include "posv_users_functions.h"
-
-/**
- *  Function that allocate an array of pointers to square tiles (allocated to 0)
- */
-MORSE_Complex64_t **allocate_tile_matrix(int m, int n, int nb){
-    int i;
-    int mt, nt;
-    MORSE_Complex64_t **mat;
-
-    /* compute number of tiles in rows and columns */
-    mt = (m%nb==0) ? (m/nb) : (m/nb+1);
-    nt = (n%nb==0) ? (n/nb) : (n/nb+1);
-    mat = malloc( mt*nt*sizeof(MORSE_Complex64_t*) );
-    if (!mat){
-        printf ("\nIn allocate_tile_matrix, memory Allocation Failure of mat !\n\n");
-        exit (EXIT_FAILURE);
-    }
-    for (i=0; i<mt*nt; i++){
-        *(mat+i) = calloc( nb*nb, sizeof(MORSE_Complex64_t) );
-        if (!*(mat+i)){
-            printf ("\nIn allocate_tile_matrix, memory Allocation Failure of *(mat+i) !\n\n");
-            exit (EXIT_FAILURE);
-        }
-    }
-    return mat;
-}
-
-int main(int argc, char *argv[]) {
-
-    int N, NB, NCPU, NCUDA;
-    MORSE_desc_t *descA = NULL, *descAC = NULL, *descB = NULL, *descX = NULL;
-    MORSE_Complex64_t **matA = NULL;
-
-    /* initialize some parameters with default values */
-    int iparam[IPARAM_SIZEOF];
-    memset(iparam, 0, IPARAM_SIZEOF*sizeof(int));
-    init_iparam(iparam);
-    iparam[IPARAM_UPLO] = MorseUpper;
-
-    /* read arguments */
-    read_args(argc, argv, iparam);
-    N  = iparam[IPARAM_N];
-    NB = iparam[IPARAM_NB];
-
-    /* allocate my tile data */
-    matA = allocate_tile_matrix(N, N, NB);
-
-    /* initialize the number of thread if not given by the user in argv*/
-    if ( iparam[IPARAM_THRDNBR] == -1 ) {
-      get_thread_count( &(iparam[IPARAM_THRDNBR]) );
-      iparam[IPARAM_THRDNBR] -= iparam[IPARAM_NCUDAS];
-    }
-    NCPU  = iparam[IPARAM_THRDNBR];
-    NCUDA = iparam[IPARAM_NCUDAS];
-
-    /* initialize MORSE */
-    MORSE_Init( NCPU, NCUDA);
-    MORSE_Set(MORSE_TILE_SIZE,        NB );
-    MORSE_Set(MORSE_INNER_BLOCK_SIZE, iparam[IPARAM_IB] );
-
-    print_header( argv[0], iparam);
-
-    /*
-     * initialize the structure required for MORSE sequential task-based algorithms
-     * MORSE_desc_t is a structure wrapping your data allowing MORSE to get
-     * pointers to tiles
-     */
-    MORSE_Desc_Create_User(&descA, matA, MorseComplexDouble,
-                           NB, NB, NB*NB, N, N, 0, 0, N, N, 1, 1,
-                           user_getaddr_arrayofpointers,
-                           user_getblkldd_arrayofpointers,
-                           user_getrankof_2d);
-
-    /* generate A matrix with random values such that it is hermitian */
-    MORSE_zplghe_Tile( (double)N, MorseUpperLower, descA, 51 );
-
-    /* generate RHS */
-    MORSE_Desc_Create(&descB, NULL, MorseComplexDouble,
-                      NB, NB, NB*NB, N, 1, 0, 0, N, 1, 1, 1);
-    MORSE_zplrnt_Tile( descB, 7672 );
-
-    /* copy A before facto. in order to check the result */
-    MORSE_Desc_Create(&descAC, NULL, MorseComplexDouble,
-                      NB, NB, NB*NB, N, N, 0, 0, N, N, 1, 1);
-    MORSE_zlacpy_Tile(MorseUpperLower, descA, descAC);
-
-    /* copy B before solving in order to check the result */
-    MORSE_Desc_Create(&descX, NULL, MorseComplexDouble,
-                      NB, NB, NB*NB, N, 1, 0, 0, N, 1, 1, 1);
-    MORSE_zlacpy_Tile(MorseUpperLower, descB, descX);
-
-    /* solve the system AX = B using the Cholesky factorization,
-     * A is replaced by its factorization L or L^T depending on uplo
-     * B is stored in X on entry, X contains the result on exit */
-    MORSE_zposv_Tile(iparam[IPARAM_UPLO], descA, descX);
-    /* note that this call is equivalent to
-     * MORSE_zpotrf_Tile(uplo, descA) followed by
-     * MORSE_zpotrs_Tile(uplo, descA, descX )
-     * */
-
-    /* check if solve is correct i.e. AX-B = 0 */
-    /* compute norms to check the result */
-    double anorm = MORSE_zlange_Tile(MorseInfNorm, descAC);
-    double bnorm = MORSE_zlange_Tile(MorseInfNorm, descB);
-    double xnorm = MORSE_zlange_Tile(MorseInfNorm, descX);
-
-    /* compute A*X-B, store the result in B */
-    MORSE_zgemm_Tile( MorseNoTrans, MorseNoTrans, 1.0, descAC, descX, -1.0, descB );
-    double res = MORSE_zlange_Tile(MorseInfNorm, descB);
-
-    /* check residual and print a message */
-    #if defined(CHAMELEON_SIMULATION)
-    double    eps = 0.;
-    #else
-    double    eps = LAPACKE_dlamch_work( 'e' );
-    #endif
-    /*
-     * if hres = 0 then the test succeed
-     * else the test failed
-     */
-    int hres = 0;
-    hres = ( res / N / eps / (anorm * xnorm + bnorm ) > 100.0 );
-    printf( "   ||Ax-b||       ||A||       ||x||       ||b|| ||Ax-b||/N/eps/(||A||||x||+||b||)  RETURN\n");
-    if (hres)
-        printf( "%8.5e %8.5e %8.5e %8.5e                       %8.5e FAILURE \n",
-            res, anorm, xnorm, bnorm,
-            res / N / eps / (anorm * xnorm + bnorm ));
-    else
-        printf( "%8.5e %8.5e %8.5e %8.5e                       %8.5e SUCCESS \n",
-            res, anorm, xnorm, bnorm,
-            res / N / eps / (anorm * xnorm + bnorm ));
-
-    /* destroy MORSE specific structures */
-    MORSE_Desc_Destroy( &descX  );
-    MORSE_Desc_Destroy( &descB  );
-    MORSE_Desc_Destroy( &descAC );
-    MORSE_Desc_Destroy( &descA  );
-
-    /* Finalize MORSE */
-    MORSE_Finalize();
-
-    return EXIT_SUCCESS;
-}
-
diff --git a/example/lapack_to_morse/CMakeLists.txt b/example/lapack_to_morse/CMakeLists.txt
index bbd241512fbac1e11ba5679ba3ea801278d2d4fb..4f506c458c162f5446f58f4d80d6994e71effd8c 100644
--- a/example/lapack_to_morse/CMakeLists.txt
+++ b/example/lapack_to_morse/CMakeLists.txt
@@ -35,56 +35,26 @@ set(LTM_SOURCES
 # Define what libraries we have to link with
 # ------------------------------------------
 unset(libs_for_ltm)
-list(APPEND libs_for_ltm
-  chameleon
-  coreblas
-  ${LAPACKE_LIBRARIES}
-)
+list(APPEND libs_for_ltm chameleon)
+# message(STATUS "libs_for_ltm: ${libs_for_ltm}")
 
 # specific compilation for step0 because we potentially want to use
 # multithreaded BLAS and LAPACK libraries for this step
 unset(libs_for_step0)
-list(APPEND libs_for_step0
-  ${libs_for_ltm}
-  ${CBLAS_LIBRARIES}
-  )
-
-if(LAPACK_PAR_LIBRARIES)
+if (BLAS_LIBRARIES_PAR)
+  # Intel MKL multithreaded
   list(APPEND libs_for_step0
-    ${LAPACK_PAR_LIBRARIES}
+    ${BLAS_LIBRARIES_PAR}
     )
 else()
+  # Any other blas/lapack suite
   list(APPEND libs_for_step0
-    ${LAPACK_SEQ_LIBRARIES}
+    ${LAPACKE_LIBRARIES_DEP}
+    ${CBLAS_LIBRARIES_DEP}
     )
 endif()
+# message(STATUS "libs_for_step0: ${libs_for_step0}")
 
-if(BLAS_PAR_LIBRARIES)
-  list(APPEND libs_for_step0
-    ${BLAS_PAR_LIBRARIES}
-    )
-else()
-  list(APPEND libs_for_step0
-    ${BLAS_SEQ_LIBRARIES}
-    )
-endif()
-
-list(APPEND libs_for_step0
-  ${EXTRA_LIBRARIES}
-  )
-
-list(APPEND libs_for_ltm
-  ${LAPACK_SEQ_LIBRARIES}
-  ${BLAS_SEQ_LIBRARIES}
-  ${EXTRA_LIBRARIES}
-  )
-
-link_directories(${LAPACKE_LIBRARY_DIRS})
-link_directories(${LAPACK_LIBRARY_DIRS})
-link_directories(${CBLAS_LIBRARY_DIRS})
-link_directories(${BLAS_LIBRARY_DIRS})
-
-# message(STATUS "libs examples: ${libs_for_ltm}")
 foreach(_ltm ${LTM_SOURCES})
     get_filename_component(_name_exe ${_ltm} NAME_WE)
     add_executable(${_name_exe} ${_ltm})
diff --git a/example/lapack_to_morse/step0.c b/example/lapack_to_morse/step0.c
index 0ae46a070a70d62fa6540d9257c26bc18ea2f4ad..ecf7d076fe9f7b368cf135286a6ce74f00e0828f 100644
--- a/example/lapack_to_morse/step0.c
+++ b/example/lapack_to_morse/step0.c
@@ -17,7 +17,6 @@
  *
  */
 #include "step0.h"
-#include <coreblas.h>
 
 /*
  * @brief step0 is a simple Cholesky example using the C interface of
diff --git a/example/lapack_to_morse/step0.h b/example/lapack_to_morse/step0.h
index 0f3f87672b85532ae2a6c03f9d23d5b8a6cea518..43248e5eaab7c8671e81e57e6c6cfc3eef8d95a1 100644
--- a/example/lapack_to_morse/step0.h
+++ b/example/lapack_to_morse/step0.h
@@ -120,4 +120,126 @@ static void print_header(char *prog_name, int * iparam) {
     return;
 }
 
+/* The following is a copy paste from coreblas/core_zplgsy and core_zplrnt.
+ * We need these routines to generate the matrices but we don't want to link with chameleon here.
+ */
+#define Rnd64_A 6364136223846793005ULL
+#define Rnd64_C 1ULL
+#define RndF_Mul 5.4210108624275222e-20f
+#define RndD_Mul 5.4210108624275222e-20
+#define NBELEM   1
+
+static unsigned long long int
+Rnd64_jump(unsigned long long int n, unsigned long long int seed ) {
+  unsigned long long int a_k, c_k, ran;
+  int i;
+
+  a_k = Rnd64_A;
+  c_k = Rnd64_C;
+
+  ran = seed;
+  for (i = 0; n; n >>= 1, i++) {
+    if (n & 1)
+      ran = a_k * ran + c_k;
+    c_k *= (a_k + 1);
+    a_k *= a_k;
+  }
+
+  return ran;
+}
+
+/**
+ * CORE_dplgsy - Generate a tile for random symmetric (positive definite if 'bump' is large enough) matrix.
+ */
+static void CORE_dplgsy( double bump, int m, int n, double *A, int lda,
+                         int bigM, int m0, int n0, unsigned long long int seed )
+{
+    double *tmp = A;
+    int64_t i, j;
+    unsigned long long int ran, jump;
+
+    jump = (unsigned long long int)m0 + (unsigned long long int)n0 * (unsigned long long int)bigM;
+
+    /*
+     * Tile diagonal
+     */
+    if ( m0 == n0 ) {
+        for (j = 0; j < n; j++) {
+            ran = Rnd64_jump( NBELEM * jump, seed );
+
+            for (i = j; i < m; i++) {
+                *tmp = 0.5f - ran * RndF_Mul;
+                ran  = Rnd64_A * ran + Rnd64_C;
+                tmp++;
+            }
+            tmp  += (lda - i + j + 1);
+            jump += bigM + 1;
+        }
+
+        for (j = 0; j < n; j++) {
+            A[j+j*lda] += bump;
+
+            for (i=0; i<j; i++) {
+                A[lda*j+i] = A[lda*i+j];
+            }
+        }
+    }
+    /*
+     * Lower part
+     */
+    else if ( m0 > n0 ) {
+        for (j = 0; j < n; j++) {
+            ran = Rnd64_jump( NBELEM * jump, seed );
+
+            for (i = 0; i < m; i++) {
+                *tmp = 0.5f - ran * RndF_Mul;
+                ran  = Rnd64_A * ran + Rnd64_C;
+                tmp++;
+            }
+            tmp  += (lda - i);
+            jump += bigM;
+        }
+    }
+    /*
+     * Upper part
+     */
+    else if ( m0 < n0 ) {
+        /* Overwrite jump */
+        jump = (unsigned long long int)n0 + (unsigned long long int)m0 * (unsigned long long int)bigM;
+
+        for (i = 0; i < m; i++) {
+            ran = Rnd64_jump( NBELEM * jump, seed );
+
+            for (j = 0; j < n; j++) {
+                A[j*lda+i] = 0.5f - ran * RndF_Mul;
+            }
+            jump += bigM;
+        }
+    }
+}
+
+/**
+ * CORE_dplrnt - Generate a tile for random matrix.
+ */
+static void CORE_dplrnt( int m, int n, double *A, int lda,
+                         int bigM, int m0, int n0, unsigned long long int seed )
+{
+	double *tmp = A;
+    int64_t i, j;
+    unsigned long long int ran, jump;
+
+    jump = (unsigned long long int)m0 + (unsigned long long int)n0 * (unsigned long long int)bigM;
+
+    for (j=0; j<n; ++j ) {
+        ran = Rnd64_jump( NBELEM*jump, seed );
+        for (i = 0; i < m; ++i) {
+            *tmp = 0.5f - ran * RndF_Mul;
+            ran  = Rnd64_A * ran + Rnd64_C;
+            tmp++;
+        }
+        tmp  += lda-i;
+        jump += bigM;
+    }
+}
+
 #endif /* STEP0_H */
diff --git a/example/out_of_core/CMakeLists.txt b/example/out_of_core/CMakeLists.txt
index 87e0b54775730c99e98fb81895f75c77416d3e9b..56d35653d8763b06ac1ac1dbc9ab93c1a78bc484 100644
--- a/example/out_of_core/CMakeLists.txt
+++ b/example/out_of_core/CMakeLists.txt
@@ -37,24 +37,10 @@ set(OOC_SOURCES
 # Define what libraries we have to link with
 # ------------------------------------------
 unset(libs_for_ooc)
-list(APPEND libs_for_ooc
-     chameleon
-     ${STARPU_LIBRARIES_DEP}
-)
-link_directories(${STARPU_LIBRARY_DIRS})
+# ooc executable depends on chameleon, starpu and lapacke (already chameleon's dependencies)
+list(APPEND libs_for_ooc chameleon)
+# message(STATUS "libs_for_ooc: ${libs_for_ooc}")
 
-list(APPEND libs_for_ooc
-  ${LAPACKE_LIBRARIES}
-  ${LAPACK_SEQ_LIBRARIES}
-  ${BLAS_SEQ_LIBRARIES}
-  ${EXTRA_LIBRARIES}
-  )
-
-link_directories(${LAPACKE_LIBRARY_DIRS})
-link_directories(${LAPACK_LIBRARY_DIRS})
-link_directories(${BLAS_LIBRARY_DIRS})
-
-# message(STATUS "libs examples: ${libs_for_ooc}")
 foreach(_ooc ${OOC_SOURCES})
     get_filename_component(_name_exe ${_ooc} NAME_WE)
     add_executable(${_name_exe} ${_ooc})
diff --git a/runtime/parsec/CMakeLists.txt b/runtime/parsec/CMakeLists.txt
index b7e2822edc65882c46c3779b87f079865863bf1b..24ce25e8f483b50ca1c97ebcef412a49d944cabf 100644
--- a/runtime/parsec/CMakeLists.txt
+++ b/runtime/parsec/CMakeLists.txt
@@ -117,11 +117,9 @@ set_property(TARGET chameleon_parsec PROPERTY INSTALL_NAME_DIR "${CMAKE_INSTALL_
 target_link_libraries(chameleon_parsec
   ${PARSEC_LIBRARIES_DEP})
 if (NOT CHAMELEON_SIMULATION)
-  target_link_libraries(chameleon_parsec
-    coreblas)
+  target_link_libraries(chameleon_parsec coreblas)
   if(CHAMELEON_USE_CUDA)
-    target_link_libraries(chameleon_parsec
-      cudablas)
+    target_link_libraries(chameleon_parsec cudablas)
   endif(CHAMELEON_USE_CUDA)
 endif(NOT CHAMELEON_SIMULATION)
 
diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt
index 381e80541e67b72a82ca556f24eceb94fb8e353e..16dca146879bf43b29f5d25c0d9593deff853449 100644
--- a/testing/CMakeLists.txt
+++ b/testing/CMakeLists.txt
@@ -104,46 +104,8 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
 # Define what libraries we have to link with
 # ------------------------------------------
 unset(libs_for_tests)
-list(APPEND libs_for_tests
-  chameleon
-  )
-
-if(CHAMELEON_USE_CUDA)
-  list(APPEND libs_for_tests
-    cudablas)
-endif()
-if(CHAMELEON_USE_CUDA)
-  link_directories(${CUDA_LIBRARY_DIRS})
-endif()
-
-list(APPEND libs_for_tests
-  coreblas
-  ${LAPACKE_LIBRARIES}
-  ${TMG_LIBRARIES}
-  ${LAPACK_LIBRARIES}
-  ${CBLAS_LIBRARIES}
-  ${BLAS_LIBRARIES}
-  )
-
-link_directories(${LAPACKE_LIBRARY_DIRS})
-link_directories(${TMG_LIBRARY_DIRS})
-link_directories(${LAPACK_LIBRARY_DIRS})
-link_directories(${CBLAS_LIBRARY_DIRS})
-link_directories(${BLAS_LIBRARY_DIRS})
-
-list(APPEND libs_for_tests
-  hqr
-  ${EXTRA_LIBRARIES}
-  )
-
-# message("LAPACKE_LIBRARY_DIRS: ${LAPACKE_LIBRARY_DIRS}")
-# message("LAPACK_LIBRARY_DIRS: ${LAPACK_LIBRARY_DIRS}")
-# message("CBLAS_LIBRARY_DIRS: ${CBLAS_LIBRARY_DIRS}")
-# message("BLAS_LIBRARY_DIRS: ${BLAS_LIBRARY_DIRS}")
-
-# list(APPEND libs_for_tests ${CMAKE_Fortran_FLAGS}  )
-# list(APPEND libs_for_tests ${CMAKE_Fortran_LDFLAGS})
-
+# testing executables depend on chameleon and cblas, lapacke, mpi (already chameleon's dependencies)
+list(APPEND libs_for_tests chameleon)
 # message(STATUS "libs testings: ${libs_for_tests}")
 
 # Create one testing per precision with all files
diff --git a/timing/CMakeLists.txt b/timing/CMakeLists.txt
index 19f3a16f7b7d2f38804c2f993b42b6e8a6b2fea5..8cd70f721192c14fc23a4a1ec44c3881cb19ee15 100644
--- a/timing/CMakeLists.txt
+++ b/timing/CMakeLists.txt
@@ -170,52 +170,10 @@ if(NOT CHAMELEON_SIMULATION)
     list(APPEND libs_for_timings chameleon_timing)
 endif()
 
-list(APPEND libs_for_timings
-  chameleon
-  )
-
-# Add dependency toward StarPU for StarPU specific calls
-if(CHAMELEON_SCHED_STARPU)
-  list(APPEND libs_for_timings
-    ${STARPU_LIBRARIES_DEP}
-    )
-  link_directories(${STARPU_LIBRARY_DIRS})
-endif()
-
-if(NOT CHAMELEON_SIMULATION)
-
-    list(APPEND libs_for_timings
-      ${LAPACKE_LIBRARIES}
-      ${TMG_LIBRARIES}
-      ${CBLAS_LIBRARIES}
-      ${LAPACK_SEQ_LIBRARIES}
-      ${BLAS_SEQ_LIBRARIES}
-    )
-
-    link_directories(${LAPACKE_LIBRARY_DIRS})
-    link_directories(${TMG_LIBRARY_DIRS})
-    link_directories(${LAPACK_LIBRARY_DIRS})
-    link_directories(${CBLAS_LIBRARY_DIRS})
-    link_directories(${BLAS_LIBRARY_DIRS})
-
-endif()
-
-list(APPEND libs_for_timings
-  hqr
-  ${EXTRA_LIBRARIES}
-  )
-
-# message("BLAS_SEQ_LIBRARIES: ${BLAS_SEQ_LIBRARIES}")
-# message("CBLAS_LIBRARIES: ${CBLAS_LIBRARIES}")
-# message("LAPACK_SEQ_LIBRARIES: ${LAPACK_SEQ_LIBRARIES}")
-# message("LAPACKE_LIBRARIES: ${LAPACKE_LIBRARIES}")
-
-# message("LAPACKE_LIBRARY_DIRS: ${LAPACKE_LIBRARY_DIRS}")
-# message("LAPACK_LIBRARY_DIRS: ${LAPACK_LIBRARY_DIRS}")
-# message("CBLAS_LIBRARY_DIRS: ${CBLAS_LIBRARY_DIRS}")
-# message("BLAS_LIBRARY_DIRS: ${BLAS_LIBRARY_DIRS}")
-
+# timing executables depend on chameleon and cblas, lapacke, starpu (optional), mpi (already chameleon's dependencies)
+list(APPEND libs_for_timings chameleon)
 # message(STATUS "libs timings: ${libs_for_timings}")
+
 foreach(_timing ${TIMINGS})
     get_filename_component(_name_exe ${_timing} NAME_WE)
     add_executable(${_name_exe} ${_timing})
diff --git a/timing/CTestLists.cmake b/timing/CTestLists.cmake
index ede59b0fb061cca8ed97a755bdd309ffa6760176..9fd359c56eb65d8a4882ab33948c6d0dd687167c 100644
--- a/timing/CTestLists.cmake
+++ b/timing/CTestLists.cmake
@@ -88,8 +88,8 @@ if (NOT CHAMELEON_SIMULATION)
 
 else (NOT CHAMELEON_SIMULATION)
 
-  set(TEST_CMD_simushm --n_range=9600:9600:1    --nb=960 )
-  set(TEST_CMD_simugpu --n_range=9600:9600:1    --nb=960 --gpus=1)
+  set(TEST_CMD_simushm -N 9600:9600:1 -b 960)
+  set(TEST_CMD_simugpu -N 9600:9600:1 -b 960 -g 1)
   set(RP_CHAMELEON_PRECISIONS_SIMU "s;d")
   foreach(cat ${TEST_CATEGORIES})
     foreach(prec ${RP_CHAMELEON_PRECISIONS_SIMU})