diff --git a/control/workspace.c b/control/workspace.c
index d66577de4821c8be8e1bf73d9fbefd598ea2eb9b..097a26711706660712005db66c7e858a2af827e9 100644
--- a/control/workspace.c
+++ b/control/workspace.c
@@ -143,7 +143,7 @@ int morse_alloc_ipiv(int M, int N, MORSE_enum func, int type, MORSE_desc_t **des
     lm = IB * MT;
     ln = NB * NT;
 
-    size = (size_t)(min(MT, NT) * NB * NT * sizeof(int));
+    size = (size_t)(chameleon_min(MT, NT) * NB * NT * sizeof(int));
     if (size <= 0) {
         *IPIV = NULL;
         return MORSE_SUCCESS;
diff --git a/runtime/parsec/codelets/codelet_zlange.c b/runtime/parsec/codelets/codelet_zlange.c
index 77f1f039c0fabb1c6d224c1b2d5c052e6e11d34b..5d1bd5dd09718f3c87663175e3473fb550b2de03 100644
--- a/runtime/parsec/codelets/codelet_zlange.c
+++ b/runtime/parsec/codelets/codelet_zlange.c
@@ -55,7 +55,7 @@ void MORSE_TASK_zlange(const MORSE_option_t *options,
 {
     dague_dtd_handle_t* DAGUE_dtd_handle = (dague_dtd_handle_t *)(options->sequence->schedopt);
 
-    int szeW = max( M, N );
+    int szeW = chameleon_max( M, N );
 
     dague_insert_task(
         DAGUE_dtd_handle, CORE_zlange_parsec, "lange",
diff --git a/runtime/parsec/codelets/codelet_zlanhe.c b/runtime/parsec/codelets/codelet_zlanhe.c
index fffdb4bec17f6d54d9053880cd42ab6f244c7e98..fc50a99381508c6e3960d729e90543c619c672ce 100644
--- a/runtime/parsec/codelets/codelet_zlanhe.c
+++ b/runtime/parsec/codelets/codelet_zlanhe.c
@@ -55,7 +55,7 @@ void MORSE_TASK_zlanhe(const MORSE_option_t *options,
 {
     dague_dtd_handle_t* DAGUE_dtd_handle = (dague_dtd_handle_t *)(options->sequence->schedopt);
 
-    int szeW = max( 1, N );
+    int szeW = chameleon_max( 1, N );
 
     dague_insert_task(
         DAGUE_dtd_handle, CORE_zlanhe_parsec, "LANHE",
diff --git a/runtime/parsec/codelets/codelet_zlansy.c b/runtime/parsec/codelets/codelet_zlansy.c
index 113d06c44fbe036d58ba918469e5135979c0e76b..62cf558513eebb33d6f222a3be6c5bc9689ef3cd 100644
--- a/runtime/parsec/codelets/codelet_zlansy.c
+++ b/runtime/parsec/codelets/codelet_zlansy.c
@@ -55,7 +55,7 @@ void MORSE_TASK_zlansy(const MORSE_option_t *options,
 {
     dague_dtd_handle_t* DAGUE_dtd_handle = (dague_dtd_handle_t *)(options->sequence->schedopt);
 
-    int szeW = max( 1, N );
+    int szeW = chameleon_max( 1, N );
 
     dague_insert_task(
         DAGUE_dtd_handle, CORE_zlansy_parsec, "lansy",
diff --git a/runtime/parsec/codelets/codelet_zlantr.c b/runtime/parsec/codelets/codelet_zlantr.c
index ef290a2a6cda59e869c57b1adc49fc1806483121..ed0cb32169f71826d1ce0036ead75f3e8b798e2a 100644
--- a/runtime/parsec/codelets/codelet_zlantr.c
+++ b/runtime/parsec/codelets/codelet_zlantr.c
@@ -58,7 +58,7 @@ void MORSE_TASK_zlantr(const MORSE_option_t *options,
 {
     dague_dtd_handle_t* DAGUE_dtd_handle = (dague_dtd_handle_t *)(options->sequence->schedopt);
 
-    int szeW = max( 1, N );
+    int szeW = chameleon_max( 1, N );
 
     dague_insert_task(
         DAGUE_dtd_handle, CORE_zlantr_parsec, "lantr",
diff --git a/runtime/quark/codelets/codelet_zlange.c b/runtime/quark/codelets/codelet_zlange.c
index c8a9f6c5fb2f80f90bc756dfd159984add0b5f58..e3a6b92ec1453b0ddb2c284cfb70f15f60674bfd 100644
--- a/runtime/quark/codelets/codelet_zlange.c
+++ b/runtime/quark/codelets/codelet_zlange.c
@@ -36,16 +36,17 @@ void MORSE_TASK_zlange(const MORSE_option_t *options,
 {
     quark_option_t *opt = (quark_option_t*)(options->schedopt);
     DAG_CORE_LANGE;
-    int szeW = max( M, N );
-	QUARK_Insert_Task(opt->quark, CORE_zlange_quark, (Quark_Task_Flags*)opt,
-		sizeof(MORSE_enum),              &norm,  VALUE,
-		sizeof(int),                     &M,     VALUE,
-		sizeof(int),                     &N,     VALUE,
-		sizeof(MORSE_Complex64_t)*NB*NB, RTBLKADDR(A, MORSE_Complex64_t, Am, An), INPUT,
-		sizeof(int),                     &LDA,   VALUE,
-		sizeof(double)*szeW,             NULL,   SCRATCH,
-		sizeof(double),                  RTBLKADDR(B, double, Bm, Bn), OUTPUT,
-		0);
+    int szeW = chameleon_max( M, N );
+    QUARK_Insert_Task(
+        opt->quark, CORE_zlange_quark, (Quark_Task_Flags*)opt,
+        sizeof(MORSE_enum),              &norm,  VALUE,
+        sizeof(int),                     &M,     VALUE,
+        sizeof(int),                     &N,     VALUE,
+        sizeof(MORSE_Complex64_t)*NB*NB, RTBLKADDR(A, MORSE_Complex64_t, Am, An), INPUT,
+        sizeof(int),                     &LDA,   VALUE,
+        sizeof(double)*szeW,             NULL,   SCRATCH,
+        sizeof(double),                  RTBLKADDR(B, double, Bm, Bn), OUTPUT,
+        0);
 }
 
 void CORE_zlange_quark(Quark *quark)
@@ -69,10 +70,11 @@ void MORSE_TASK_zlange_max(const MORSE_option_t *options,
 {
     quark_option_t *opt = (quark_option_t*)(options->schedopt);
     DAG_CORE_LANGE_MAX;
-	QUARK_Insert_Task(opt->quark, CORE_zlange_max_quark, (Quark_Task_Flags*)opt,
-		sizeof(double), RTBLKADDR(A, double, Am, An), INPUT,
-		sizeof(double), RTBLKADDR(B, double, Bm, Bn), OUTPUT,
-		0);
+    QUARK_Insert_Task(
+        opt->quark, CORE_zlange_max_quark, (Quark_Task_Flags*)opt,
+        sizeof(double), RTBLKADDR(A, double, Am, An), INPUT,
+        sizeof(double), RTBLKADDR(B, double, Bm, Bn), OUTPUT,
+        0);
 }
 
 
@@ -82,7 +84,7 @@ void CORE_zlange_max_quark(Quark *quark)
     double *normA;
 
     quark_unpack_args_2(quark, A, normA);
-	if ( A[0] > *normA )
-		*normA = A[0];
+    if ( A[0] > *normA )
+        *normA = A[0];
 }
 
diff --git a/runtime/quark/codelets/codelet_zlanhe.c b/runtime/quark/codelets/codelet_zlanhe.c
index f3bd6fa8c24ee785a2c3efb139bf3d52f07772ad..70ab4cf8f7d4cf9b266fd5426c914b1ced81b211 100644
--- a/runtime/quark/codelets/codelet_zlanhe.c
+++ b/runtime/quark/codelets/codelet_zlanhe.c
@@ -36,16 +36,17 @@ void MORSE_TASK_zlanhe(const MORSE_option_t *options,
 {
     quark_option_t *opt = (quark_option_t*)(options->schedopt);
     DAG_CORE_LANHE;
-    int szeW = max( 1, N );
-	QUARK_Insert_Task(opt->quark, CORE_zlanhe_quark, (Quark_Task_Flags*)opt,
-		sizeof(MORSE_enum),              &norm,  VALUE,
-		sizeof(MORSE_enum),              &uplo,  VALUE,
-		sizeof(int),                     &N,     VALUE,
-		sizeof(MORSE_Complex64_t)*NB*NB, RTBLKADDR(A, MORSE_Complex64_t, Am, An), INPUT,
-		sizeof(int),                     &LDA,   VALUE,
-		sizeof(double)*szeW,             NULL,   SCRATCH,
-		sizeof(double),                  RTBLKADDR(B, double, Bm, Bn), OUTPUT,
-		0);
+    int szeW = chameleon_max( 1, N );
+    QUARK_Insert_Task(
+        opt->quark, CORE_zlanhe_quark, (Quark_Task_Flags*)opt,
+        sizeof(MORSE_enum),              &norm,  VALUE,
+        sizeof(MORSE_enum),              &uplo,  VALUE,
+        sizeof(int),                     &N,     VALUE,
+        sizeof(MORSE_Complex64_t)*NB*NB, RTBLKADDR(A, MORSE_Complex64_t, Am, An), INPUT,
+        sizeof(int),                     &LDA,   VALUE,
+        sizeof(double)*szeW,             NULL,   SCRATCH,
+        sizeof(double),                  RTBLKADDR(B, double, Bm, Bn), OUTPUT,
+        0);
 }
 
 void CORE_zlanhe_quark(Quark *quark)
diff --git a/runtime/quark/codelets/codelet_zlansy.c b/runtime/quark/codelets/codelet_zlansy.c
index 3aaf510c415531130ec19271bd67b423704ecf0f..43e2132e17912a2bc6823195910b0119b1ac734c 100644
--- a/runtime/quark/codelets/codelet_zlansy.c
+++ b/runtime/quark/codelets/codelet_zlansy.c
@@ -36,8 +36,9 @@ void MORSE_TASK_zlansy(const MORSE_option_t *options,
 {
     quark_option_t *opt = (quark_option_t*)(options->schedopt);
     DAG_CORE_LANSY;
-    int szeW = max( 1, N );
-    QUARK_Insert_Task(opt->quark, CORE_zlansy_quark, (Quark_Task_Flags*)opt,
+    int szeW = chameleon_max( 1, N );
+    QUARK_Insert_Task(
+        opt->quark, CORE_zlansy_quark, (Quark_Task_Flags*)opt,
         sizeof(MORSE_enum),              &norm,  VALUE,
         sizeof(MORSE_enum),              &uplo,  VALUE,
         sizeof(int),                     &N,     VALUE,
diff --git a/runtime/quark/codelets/codelet_zlantr.c b/runtime/quark/codelets/codelet_zlantr.c
index b964eb3aa7443685f09ee11fbffe9c24c90cff62..a6d0009b5481a8784cd908c9ede233c7a5d32839 100644
--- a/runtime/quark/codelets/codelet_zlantr.c
+++ b/runtime/quark/codelets/codelet_zlantr.c
@@ -34,8 +34,9 @@ void MORSE_TASK_zlantr(const MORSE_option_t *options,
 {
     quark_option_t *opt = (quark_option_t*)(options->schedopt);
     DAG_CORE_LANTR;
-    int szeW = max( 1, N );
-    QUARK_Insert_Task(opt->quark, CORE_zlantr_quark, (Quark_Task_Flags*)opt,
+    int szeW = chameleon_max( 1, N );
+    QUARK_Insert_Task(
+        opt->quark, CORE_zlantr_quark, (Quark_Task_Flags*)opt,
         sizeof(MORSE_enum),              &norm,  VALUE,
         sizeof(MORSE_enum),              &uplo,  VALUE,
         sizeof(MORSE_enum),              &diag,  VALUE,
diff --git a/timing/time_zgemm.c b/timing/time_zgemm.c
index c00f590c77b6c55413525a8582fb6f7fe9c31237..57e50ba0fc8ea0225acb7513f23b017e681ebe3d 100644
--- a/timing/time_zgemm.c
+++ b/timing/time_zgemm.c
@@ -26,13 +26,13 @@
 #include "timing_zauxiliary.h"
 
 static int
-RunTest(int *iparam, double *dparam, morse_time_t *t_) 
+RunTest(int *iparam, double *dparam, morse_time_t *t_)
 {
     MORSE_Complex64_t alpha, beta;
     PASTE_CODE_IPARAM_LOCALS( iparam );
 
-    LDB = max(K, iparam[IPARAM_LDB]);
-    LDC = max(M, iparam[IPARAM_LDC]);
+    LDB = chameleon_max(K, iparam[IPARAM_LDB]);
+    LDC = chameleon_max(M, iparam[IPARAM_LDC]);
 
     /* Allocate Data */
     PASTE_CODE_ALLOCATE_MATRIX( A,      1, MORSE_Complex64_t, LDA, K   );
diff --git a/timing/time_zgemm_tile.c b/timing/time_zgemm_tile.c
index 95d0d0c3d17a574ab508a1e5cc8308e0621745f1..7bd1ba7614b99ef773643b75ad9bc23581137992 100644
--- a/timing/time_zgemm_tile.c
+++ b/timing/time_zgemm_tile.c
@@ -26,14 +26,14 @@
 #include "timing_zauxiliary.h"
 
 static int
-RunTest(int *iparam, double *dparam, morse_time_t *t_) 
+RunTest(int *iparam, double *dparam, morse_time_t *t_)
 {
     MORSE_Complex64_t alpha, beta;
     PASTE_CODE_IPARAM_LOCALS( iparam );
 
 
-    LDB = max(K, iparam[IPARAM_LDB]);
-    LDC = max(M, iparam[IPARAM_LDC]);
+    LDB = chameleon_max(K, iparam[IPARAM_LDB]);
+    LDC = chameleon_max(M, iparam[IPARAM_LDC]);
 
     /* Allocate Data */
     PASTE_CODE_ALLOCATE_MATRIX_TILE( descA, 1, MORSE_Complex64_t, MorseComplexDouble, LDA, M, K );
diff --git a/timing/time_zgetrf_incpiv.c b/timing/time_zgetrf_incpiv.c
index de056859261560c10f5a2e57d54adbc4f6f0a5db..28a5814dd670cabedc596621ec2a01c8bcdbc37c 100644
--- a/timing/time_zgetrf_incpiv.c
+++ b/timing/time_zgetrf_incpiv.c
@@ -26,7 +26,7 @@
 #include "timing_zauxiliary.h"
 
 static int
-RunTest(int *iparam, double *dparam, morse_time_t *t_) 
+RunTest(int *iparam, double *dparam, morse_time_t *t_)
 {
     MORSE_desc_t *L;
     int *piv;
@@ -44,7 +44,7 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
     MORSE_zplrnt(M, N, A, LDA, 3456);
 
     /* Allocate Workspace */
-    MORSE_Alloc_Workspace_zgesv_incpiv( min(M,N), &L, &piv, P, Q);
+    MORSE_Alloc_Workspace_zgesv_incpiv( chameleon_min(M,N), &L, &piv, P, Q);
 
     /* Save AT in lapack layout for check */
     PASTE_CODE_ALLOCATE_COPY( Acpy, check, MORSE_Complex64_t, A, LDA, N );
@@ -63,8 +63,8 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
         MORSE_zgetrs_incpiv( MorseNoTrans, N, NRHS, A, LDA, L, piv, X, LDB );
 
         dparam[IPARAM_RES] = z_check_solution(M, N, NRHS, Acpy, LDA, B, X, LDB,
-                                              &(dparam[IPARAM_ANORM]), 
-                                              &(dparam[IPARAM_BNORM]), 
+                                              &(dparam[IPARAM_ANORM]),
+                                              &(dparam[IPARAM_BNORM]),
                                               &(dparam[IPARAM_XNORM]));
 
         free( Acpy ); free( B ); free( X );
diff --git a/timing/time_zgetrf_incpiv_tile.c b/timing/time_zgetrf_incpiv_tile.c
index 0aea8a953114a2cac15b35fd4c684051c429ff42..907f53ac3423f1fbce55a4966274d5da2e3e733d 100644
--- a/timing/time_zgetrf_incpiv_tile.c
+++ b/timing/time_zgetrf_incpiv_tile.c
@@ -25,7 +25,7 @@
 #include "./timing.c"
 
 static int
-RunTest(int *iparam, double *dparam, morse_time_t *t_) 
+RunTest(int *iparam, double *dparam, morse_time_t *t_)
 {
     MORSE_desc_t *descL;
     int *piv;
@@ -52,7 +52,7 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
     MORSE_zplrnt_Tile(descA, 3456);
 
     /* Allocate Workspace */
-    MORSE_Alloc_Workspace_zgesv_incpiv_Tile(min(M,N), &descL, &piv, P, Q);
+    MORSE_Alloc_Workspace_zgesv_incpiv_Tile(chameleon_min(M,N), &descL, &piv, P, Q);
 
     /* Save A for check */
     if (check == 1){
diff --git a/timing/time_zgetrs_incpiv_tile.c b/timing/time_zgetrs_incpiv_tile.c
index 491da4f43ff45f71ef728f908fa744ded2c7a1ac..3ba081e9cdbd64632b5a7d2c39e1cf61a9529e54 100644
--- a/timing/time_zgetrs_incpiv_tile.c
+++ b/timing/time_zgetrs_incpiv_tile.c
@@ -25,7 +25,7 @@
 #include "./timing.c"
 
 static int
-RunTest(int *iparam, double *dparam, morse_time_t *t_) 
+RunTest(int *iparam, double *dparam, morse_time_t *t_)
 {
     MORSE_desc_t *descL;
     int *piv;
@@ -53,7 +53,7 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
     MORSE_zplrnt_Tile(descA, 3456);
 
     /* Allocate Workspace */
-    MORSE_Alloc_Workspace_zgesv_incpiv_Tile(min(M,N), &descL, &piv, P, Q);
+    MORSE_Alloc_Workspace_zgesv_incpiv_Tile(chameleon_min(M,N), &descL, &piv, P, Q);
 
     /* Save A for check */
     if (check == 1){
diff --git a/timing/time_zheevd_tile.c b/timing/time_zheevd_tile.c
index d659b82138de39592c6925f0f2ce709560e15f77..56b08fa76c9a77d4f3e8198f55e4b4c39607074b 100644
--- a/timing/time_zheevd_tile.c
+++ b/timing/time_zheevd_tile.c
@@ -34,7 +34,7 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
     int vec  = MorseVec;
     int INFO;
 
-    LDA = max(LDA, N);
+    LDA = chameleon_max(LDA, N);
 
     /* Allocate Data */
     PASTE_CODE_ALLOCATE_MATRIX( A, 1, MORSE_Complex64_t, LDA, N);
diff --git a/timing/time_zlange.c b/timing/time_zlange.c
index 502ceee3c5b30e75fe394f2c2688ef0d367c0be3..25ffb956943f3dcf0d4cd08ed10fdadbea501d26 100644
--- a/timing/time_zlange.c
+++ b/timing/time_zlange.c
@@ -45,7 +45,7 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
     /* Check the solution */
     if ( check )
     {
-        double *work = (double*) malloc(max(M,N)*sizeof(double));
+        double *work = (double*) malloc(chameleon_max(M,N)*sizeof(double));
         normlapack = LAPACKE_zlange_work(LAPACK_COL_MAJOR, morse_lapack_const(norm), M, N, A, LDA, work);
         result = fabs(normmorse - normlapack);
         switch(norm) {
diff --git a/timing/time_zlange_tile.c b/timing/time_zlange_tile.c
index 36af154fefdf261cd958308d9784e197050bbc2c..a12174a9418578a7929adb1ca23379aedd93a95c 100644
--- a/timing/time_zlange_tile.c
+++ b/timing/time_zlange_tile.c
@@ -47,7 +47,7 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
     {
         /* Allocate Data */
         PASTE_TILE_TO_LAPACK( descA, A, check, MORSE_Complex64_t, M, N );
-        double *work = (double*) malloc(max(M,N)*sizeof(double));
+        double *work = (double*) malloc(chameleon_max(M,N)*sizeof(double));
         normlapack = LAPACKE_zlange_work(LAPACK_COL_MAJOR, morse_lapack_const(norm), M, N, A, LDA, work);
         result = fabs(normmorse - normlapack);
         switch(norm) {
diff --git a/timing/time_zposv.c b/timing/time_zposv.c
index 979a2f5303dc298a80b2b46de68961a91871881e..67af772cff309d5aedb4075e2c72af046ad139e1 100644
--- a/timing/time_zposv.c
+++ b/timing/time_zposv.c
@@ -26,17 +26,17 @@
 #include "timing_zauxiliary.h"
 
 static int
-RunTest(int *iparam, double *dparam, morse_time_t *t_) 
+RunTest(int *iparam, double *dparam, morse_time_t *t_)
 {
     PASTE_CODE_IPARAM_LOCALS( iparam );
     MORSE_enum uplo = MorseUpper;
-    
-    LDA = max(LDA, N);
-    
+
+    LDA = chameleon_max(LDA, N);
+
     /* Allocate Data */
     PASTE_CODE_ALLOCATE_MATRIX( A, 1, MORSE_Complex64_t, LDA, N    );
     PASTE_CODE_ALLOCATE_MATRIX( X, 1, MORSE_Complex64_t, LDB, NRHS );
-    
+
     /* Initialiaze Data */
     MORSE_zplghe((double)N, MorseUpperLower, N, A, LDA, 51 );
     MORSE_zplrnt( N, NRHS, X, LDB, 5673 );
@@ -54,13 +54,13 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
     if (check)
       {
         dparam[IPARAM_RES] = z_check_solution(N, N, NRHS, Acpy, LDA, B, X, LDB,
-                                              &(dparam[IPARAM_ANORM]), 
-                                              &(dparam[IPARAM_BNORM]), 
+                                              &(dparam[IPARAM_ANORM]),
+                                              &(dparam[IPARAM_BNORM]),
                                               &(dparam[IPARAM_XNORM]));
         free(Acpy); free(B);
       }
 
-    free(A); free(X); 
+    free(A); free(X);
 
     return 0;
 }
diff --git a/timing/time_zposv_tile.c b/timing/time_zposv_tile.c
index 205e06ae88a496ac74b9a79b562168937d0f904d..319f70e64e9194c51e95c4349b4a5b79cfdcf9d8 100644
--- a/timing/time_zposv_tile.c
+++ b/timing/time_zposv_tile.c
@@ -30,7 +30,7 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
     PASTE_CODE_IPARAM_LOCALS( iparam );
     MORSE_enum uplo = MorseUpper;
 
-    LDA = max(LDA, N);
+    LDA = chameleon_max(LDA, N);
 
     /* Allocate Data */
     PASTE_CODE_ALLOCATE_MATRIX_TILE( descA, 1,      MORSE_Complex64_t, MorseComplexDouble, LDA, N, N );
diff --git a/timing/time_zpotrf.c b/timing/time_zpotrf.c
index 0f4d46619dc57bf59e4df13e6cbd44b84ac691d2..6a242c229d7073ddefe94ca5ef48a7ff492a5cfd 100644
--- a/timing/time_zpotrf.c
+++ b/timing/time_zpotrf.c
@@ -31,7 +31,7 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
     PASTE_CODE_IPARAM_LOCALS( iparam );
     int uplo = MorseLower;
 
-    LDA = max(LDA, N);
+    LDA = chameleon_max(LDA, N);
 
     /* Allocate Data */
     PASTE_CODE_ALLOCATE_MATRIX( A, 1, MORSE_Complex64_t, LDA, N );
diff --git a/timing/time_zpotrf_tile.c b/timing/time_zpotrf_tile.c
index 14fdc32fc19a98602e03266494a4193eefde0291..475aea6948124cfe987fe174a1bbd5ec25d3e90b 100644
--- a/timing/time_zpotrf_tile.c
+++ b/timing/time_zpotrf_tile.c
@@ -30,7 +30,7 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
     PASTE_CODE_IPARAM_LOCALS( iparam );
     int uplo = MorseUpper;
 
-    LDA = max(LDA, N);
+    LDA = chameleon_max(LDA, N);
 
     /* Allocate Data */
     PASTE_CODE_ALLOCATE_MATRIX_TILE( descA,  1,     MORSE_Complex64_t, MorseComplexDouble, LDA, N, N    );
diff --git a/timing/time_zpotri_tile.c b/timing/time_zpotri_tile.c
index a8e8bcab46eff4e5c0ea61ea4f558c319c508cb7..07ef6007f8a71bf8fd275301ce0c3af344ca26b2 100644
--- a/timing/time_zpotri_tile.c
+++ b/timing/time_zpotri_tile.c
@@ -27,19 +27,19 @@
 #include "./timing.c"
 
 static int
-RunTest(int *iparam, double *dparam, morse_time_t *t_) 
+RunTest(int *iparam, double *dparam, morse_time_t *t_)
 {
     PASTE_CODE_IPARAM_LOCALS( iparam );
     MORSE_enum uplo = MorseLower;
 
-    LDA = max(LDA, N);
+    LDA = chameleon_max(LDA, N);
 
     /* Allocate Data */
     PASTE_CODE_ALLOCATE_MATRIX_TILE( descA, 1, MORSE_Complex64_t, MorseComplexDouble, LDA, N, N );
 
-    /* 
-     * Initialize Data 
-     * It's done in static to avoid having the same sequence than one 
+    /*
+     * Initialize Data
+     * It's done in static to avoid having the same sequence than one
      * the function we want to trace
      */
     MORSE_zplghe_Tile( (double)N, MorseUpperLower, descA, 51 );
diff --git a/timing/time_zpotrs_tile.c b/timing/time_zpotrs_tile.c
index c50e86b05ca860de6318b3e001a5357151996ae1..131393d41d10380c336cefd4210da8e75bcb8cf4 100644
--- a/timing/time_zpotrs_tile.c
+++ b/timing/time_zpotrs_tile.c
@@ -30,7 +30,7 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
     PASTE_CODE_IPARAM_LOCALS( iparam );
     int uplo = MorseUpper;
 
-    LDA = max(LDA, N);
+    LDA = chameleon_max(LDA, N);
     check = 1;
 
     /* Allocate Data */
diff --git a/timing/time_zsytrf_tile.c b/timing/time_zsytrf_tile.c
index 6c1d880edc120245f527a447db4c55562bf1ea80..b3ea2ab4b705ef69ce3985b1f9c58f19938a84c8 100644
--- a/timing/time_zsytrf_tile.c
+++ b/timing/time_zsytrf_tile.c
@@ -30,7 +30,7 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
     PASTE_CODE_IPARAM_LOCALS( iparam );
     int uplo = MorseUpper;
 
-    LDA = max(LDA, N);
+    LDA = chameleon_max(LDA, N);
 
     /* Allocate Data */
     PASTE_CODE_ALLOCATE_MATRIX_TILE( descA,  1,     MORSE_Complex64_t, MorseComplexDouble, LDA, N, N    );
diff --git a/timing/time_ztrsm.c b/timing/time_ztrsm.c
index 1216bb19792c7e71d8986f01855dc83f6f1fd882..96413f96fe8e07dcc1a353cd8337c6117d502b31 100644
--- a/timing/time_ztrsm.c
+++ b/timing/time_ztrsm.c
@@ -30,8 +30,8 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
 {
     MORSE_Complex64_t alpha;
     PASTE_CODE_IPARAM_LOCALS( iparam );
-    
-    LDA = max( LDA, N );
+
+    LDA = chameleon_max( LDA, N );
 
     /* Allocate Data */
     PASTE_CODE_ALLOCATE_MATRIX( A,      1, MORSE_Complex64_t, LDA, N   );
@@ -57,10 +57,10 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
     /* Check the solution */
     if (check)
     {
-        dparam[IPARAM_RES] = z_check_trsm( MorseLeft, MorseUpper, MorseNoTrans, MorseUnit, 
+        dparam[IPARAM_RES] = z_check_trsm( MorseLeft, MorseUpper, MorseNoTrans, MorseUnit,
                                            N, NRHS,
                                            alpha, A, LDA, B, B2, LDB,
-                                           &(dparam[IPARAM_ANORM]), 
+                                           &(dparam[IPARAM_ANORM]),
                                            &(dparam[IPARAM_BNORM]),
                                            &(dparam[IPARAM_XNORM]));
         free(B2);
diff --git a/timing/timing.c b/timing/timing.c
index 28bb1c23a6e2b514d101fe3fe44177819492a460..533fc41c1a582a0f41a1de5ad79c1f304f82a2dd 100644
--- a/timing/timing.c
+++ b/timing/timing.c
@@ -700,9 +700,9 @@ main(int argc, char *argv[]) {
     {
         if ( nx > 0 ) {
             iparam[IPARAM_M] = i;
-            iparam[IPARAM_N] = max(1, i/nx);
+            iparam[IPARAM_N] = chameleon_max(1, i/nx);
         } else if ( mx > 0 ) {
-            iparam[IPARAM_M] = max(1, i/mx);
+            iparam[IPARAM_M] = chameleon_max(1, i/mx);
             iparam[IPARAM_N] = i;
         } else {
             if ( m == -1 )
diff --git a/timing/timing.h b/timing/timing.h
index 948866a778d05dd648a393b2a35b357851d35b2f..fd2ac6ac3549b75900eab0d622addc5d083f080a 100644
--- a/timing/timing.h
+++ b/timing/timing.h
@@ -86,9 +86,9 @@ enum dparam_timing {
     int64_t N     = iparam[IPARAM_N];              \
     int64_t K     = iparam[IPARAM_K];              \
     int64_t NRHS  = K;                             \
-    int64_t LDA   = max(M, iparam[IPARAM_LDA]);    \
-    int64_t LDB   = max(N, iparam[IPARAM_LDB]);    \
-    int64_t LDC   = max(K, iparam[IPARAM_LDC]);    \
+    int64_t LDA   = chameleon_max(M, iparam[IPARAM_LDA]);    \
+    int64_t LDB   = chameleon_max(N, iparam[IPARAM_LDB]);    \
+    int64_t LDC   = chameleon_max(K, iparam[IPARAM_LDC]);    \
     int64_t IB    = iparam[IPARAM_IB];             \
     int64_t MB    = iparam[IPARAM_MB];             \
     int64_t NB    = iparam[IPARAM_NB];             \
diff --git a/timing/timing_zauxiliary.c b/timing/timing_zauxiliary.c
index 45c844251b025d144f7a911a6e3c0f69a741edf0..2d9dba18dcddb9371939207a22ff7c9be2aad7d4 100644
--- a/timing/timing_zauxiliary.c
+++ b/timing/timing_zauxiliary.c
@@ -33,7 +33,7 @@ int z_check_orthogonality(int M, int N, int LDQ, MORSE_Complex64_t *Q)
     double normQ;
     int info_ortho;
     int i;
-    int minMN = min(M, N);
+    int minMN = chameleon_min(M, N);
     double eps;
     double *work = (double *)malloc(minMN*sizeof(double));
 
@@ -89,7 +89,7 @@ int z_check_QRfactorization(int M, int N, MORSE_Complex64_t *A1, MORSE_Complex64
 
     MORSE_Complex64_t *Ql       = (MORSE_Complex64_t *)malloc(M*N*sizeof(MORSE_Complex64_t));
     MORSE_Complex64_t *Residual = (MORSE_Complex64_t *)malloc(M*N*sizeof(MORSE_Complex64_t));
-    double *work              = (double *)malloc(max(M,N)*sizeof(double));
+    double *work              = (double *)malloc(chameleon_max(M,N)*sizeof(double));
 
     alpha=1.0;
     beta=0.0;
@@ -226,7 +226,7 @@ double z_check_gemm(MORSE_enum transA, MORSE_enum transB, int M, int N, int K,
 {
     MORSE_Complex64_t beta_const = -1.0;
     double Rnorm;
-    double *work = (double *)malloc(max(K,max(M, N))* sizeof(double));
+    double *work = (double *)malloc(chameleon_max(K,chameleon_max(M, N))* sizeof(double));
 
     *Cinitnorm   = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', M, N, Cref,    LDC, work);
     *Cmorsenorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', M, N, Cmorse, LDC, work);
@@ -256,7 +256,7 @@ double z_check_trsm(MORSE_enum side, MORSE_enum uplo, MORSE_enum trans, MORSE_en
 {
     MORSE_Complex64_t beta_const = -1.0;
     double Rnorm;
-    double *work = (double *)malloc(max(M, NRHS)* sizeof(double));
+    double *work = (double *)malloc(chameleon_max(M, NRHS)* sizeof(double));
     /*double eps = LAPACKE_dlamch_work('e');*/
 
     *Binitnorm   = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'i', M, NRHS, Bref,    LDB, work);
@@ -272,7 +272,7 @@ double z_check_trsm(MORSE_enum side, MORSE_enum uplo, MORSE_enum trans, MORSE_en
 
     Rnorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'i', M, NRHS, Bref, LDB, work);
     Rnorm = Rnorm / *Blapacknorm;
-    /* max(M,NRHS) * eps);*/
+    /* chameleon_max(M,NRHS) * eps);*/
 
     free(work);
 
@@ -291,7 +291,7 @@ double z_check_solution(int M, int N, int NRHS, MORSE_Complex64_t *A, int LDA,
     double Rnorm = -1.00;
     MORSE_Complex64_t zone  =  1.0;
     MORSE_Complex64_t mzone = -1.0;
-    double *work = (double *)malloc(max(M, N)* sizeof(double));
+    double *work = (double *)malloc(chameleon_max(M, N)* sizeof(double));
 
     *anorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', M, N,    A, LDA, work);
     *xnorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', M, NRHS, X, LDB, work);