@@ -425,7 +425,12 @@ FUNCTION CRTM_K_Matrix( &
425425 CALL OMP_SET_MAX_ACTIVE_LEVELS(1 )
426426 ELSE
427427
428- n_profile_threads = n_Profiles ! ** e.g, NOMP = 8, n_profiles = 2 -> n_profile_threads = 2
428+ n_profile_threads = n_Profiles ! ** e.g, NOMP = 8, n_profiles = 2 -> n_profile_threads = 2
429+ ! ** BTJ: temporary preprocessor directive for openMP over channels bypass, permitting modern ifort / ifx versions to run properly
430+ ! ** https://github.com/JCSDA/CRTMv3/issues/231
431+ #if 1
432+ n_channel_threads= 1
433+ #else
429434 !** if n_channels < (n_omp_threads-n_profile_threads), no need to use additional threads
430435 n_channel_threads = MIN(n_channels, MAX(1,n_omp_threads-n_profile_threads))
431436 IF (n_profile_threads + n_channel_threads > n_omp_threads) THEN
@@ -434,6 +439,7 @@ FUNCTION CRTM_K_Matrix( &
434439 n_profile_threads, n_channel_threads, n_omp_threads
435440 CALL Display_Message( ROUTINE_NAME, Message, Error_Status )
436441 END IF
442+ #endif
437443 if (n_channel_threads > 1 ) THEN
438444 CALL OMP_SET_MAX_ACTIVE_LEVELS(2 )
439445 ELSE
@@ -923,12 +929,23 @@ FUNCTION profile_solution (m, Opt, AncillaryInput) RESULT( Error_Status )
923929 ! ------------
924930 ! THREAD LOOP
925931 ! ------------
932+ ! ** BTJ preprocessor directive bypass of OMP directives causing issues when compiling with modern ifort/ifx
933+ ! ** https://github.com/JCSDA/CRTMv3/issues/231
934+ #if 1
935+ IF (n_channel_threads > 1 ) THEN
936+ WRITE ( Message,' ("ERROR: n_channel_threads > 1, this should not happen with the current preprocessor directives")' )
937+
938+ Error_status = FAILURE
939+ CALL Display_Message( ROUTINE_NAME, Message, Error_Status )
940+ END IF
941+ #else
926942!$OMP PARALLEL DO NUM_THREADS(n_channel_threads) &
927943!$OMP FIRSTPRIVATE(ln, r_cloudy) &
928944!$OMP PRIVATE(Message, ChannelIndex, n_Full_Streams, PVar, AAvar, &
929945!$OMP start_ch, end_ch, Wavenumber, Status_FWD, Status_K, &
930946!$OMP transmittance, transmittance_K, transmittance_clear, &
931947!$OMP transmittance_clear_K, l, mth_Azi)
948+ #endif
932949 Thread_Loop: DO nt = 1 , n_channel_threads
933950 start_ch = (nt - 1 ) * chunk_ch + 1
934951 IF ( nt == n_channel_threads) THEN
@@ -1681,8 +1698,12 @@ FUNCTION profile_solution (m, Opt, AncillaryInput) RESULT( Error_Status )
16811698 END IF
16821699
16831700 END DO Channel_Loop
1684- END DO Thread_Loop
1701+ END DO Thread_Loop
1702+ ! ** BTJ preprocessor directive bypass of OMP directives causing issues when compiling with modern ifort/ifx
1703+ ! ** https://github.com/JCSDA/CRTMv3/issues/231
1704+ #if 0
16851705!$OMP END PARALLEL DO
1706+ #endif
16861707 IF ( Error_Status == FAILURE ) RETURN
16871708 ln = ln + n_sensor_channels - n_inactive_channels(n_channel_threads)
16881709
0 commit comments