      va_end( ap );
    }
  }
+@@ -1343,6 +1404,8 @@ ompc_set_dynamic( int flag )
+ 
+     __kmp_save_internal_controls( thread );
+ 
++    if(!flag && __kmp_global.g.g_dynamic_mode == dynamic_scaf)
++       scaf_not_malleable();
+     set__dynamic( thread, flag ? TRUE : FALSE );
+ }
+ 
+diff --git a/src/kmp_ftn_entry.h b/src/kmp_ftn_entry.h
+index e7827bf..431cbbf 100644
+--- a/src/kmp_ftn_entry.h
++++ b/src/kmp_ftn_entry.h
+@@ -44,6 +44,11 @@
+ 
+ #include "kmp_i18n.h"
+ 
++extern "C"
++{
++#include <scaf.h>
++}
++
+ #ifdef __cplusplus
+     extern "C" {
+ #endif // __cplusplus
+@@ -530,6 +535,8 @@ xexpand(FTN_SET_DYNAMIC)( int KMP_DEREF flag )
+         __kmp_save_internal_controls( thread );
+         set__dynamic( thread, KMP_DEREF flag ? TRUE : FALSE );
+     #endif
++        if(!(KMP_DEREF flag) && __kmp_global.g.g_dynamic_mode == dynamic_scaf)
++           scaf_not_malleable();
+ }
+ 
+ 
 diff --git a/src/kmp_runtime.c b/src/kmp_runtime.c
 index 659fe76..9145a76 100644
 --- a/src/kmp_runtime.c

         // AC: If we execute teams from parallel region (on host), then teams
         //     should be created but each can only have 1 thread if nesting is disabled.
diff --git a/src/kmp_settings.c b/src/kmp_settings.c
index 40c0499..00788d4 100644
--- a/src/kmp_settings.c
+++ b/src/kmp_settings.c
@@ -3357,6 +3357,9 @@ __kmp_stg_parse_kmp_dynamic_mode( char const * name, char const * value, void *
     else if ( __kmp_str_match( "random", 1, value ) ) {
         __kmp_global.g.g_dynamic_mode = dynamic_random;
     }
+    else if ( __kmp_str_match( "scaf", 0, value ) ) {
+        __kmp_global.g.g_dynamic_mode = dynamic_scaf;
+    }
     else {
         KMP_WARNING( StgInvalidValue, name, value );

 
 /* external schedule constants, duplicate enum omp_sched in omp.h in order to not include it here */
diff --git a/src/kmp_csupport.c b/src/kmp_csupport.c
index 0fcf09b..cfb9c19 100644
--- a/src/kmp_csupport.c
+++ b/src/kmp_csupport.c
@@ -40,6 +40,12 @@
