logical MASK comparison

14 views
Skip to first unread message

Carsten Lemmen

unread,
Aug 14, 2019, 8:40:00 AM8/14/19
to fabm-...@googlegroups.com, Frank-Detle...@hzg.de
Dear Jorn et al,

I noticed that for a host with _FABM_MASK_TYPE_ logical, the gfortran
compiler complains about using '==' instead of '.eqv.', and fails to
compile entirely.

$ mpifort --version
GNU Fortran (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)
$ make
[ 97%] Building Fortran object CMakeFiles/fabm.dir/src/fabm.F90.o
../code/src/fabm.F90:2982.31:

environment%mask (l__) = self%mask (i__,j__,l__)==.false.
1
Error: Logicals at (1) must be compared with .eqv. instead of ==

I locally fixed this by applying the patch below. Please consider
testing and adding this to FABM.

Cheers,
Carsten

-bash-4.2$ git diff include/fabm_private.h
diff --git a/include/fabm_private.h b/include/fabm_private.h
index 38af8f6..61489bc 100644
--- a/include/fabm_private.h
+++ b/include/fabm_private.h
@@ -180,9 +180,17 @@
# ifdef _FABM_IS_UNMASKED_
# define _IS_UNMASKED_(maskvalue) _FABM_IS_UNMASKED_(maskvalue)
# elif defined(_FABM_MASKED_VALUE_)
-# define _IS_UNMASKED_(maskvalue) maskvalue/=_FABM_MASKED_VALUE_
+# if _FABM_MASK_TYPE_ == logical
+# define _IS_UNMASKED_(maskvalue) maskvalue.neqv._FABM_MASKED_VALUE_
+# else
+# define _IS_UNMASKED_(maskvalue) maskvalue/=_FABM_MASKED_VALUE_
+# endif
# elif defined(_FABM_UNMASKED_VALUE_)
-# define _IS_UNMASKED_(maskvalue) maskvalue==_FABM_UNMASKED_VALUE_
+# if _FABM_MASK_TYPE_ == logical
+# define _IS_UNMASKED_(maskvalue) maskvalue.eqv._FABM_UNMASKED_VALUE_
+# else
+# define _IS_UNMASKED_(maskvalue) maskvalue==_FABM_UNMASKED_VALUE_
+# endif
# else
# error If _FABM_MASK_TYPE_ is set, _FABM_MASKED_VALUE_,
_FABM_UNMASKED_VALUE_ or _FABM_IS_UNMASKED_ must be set as well.
# endif



--
Dr. rer. nat. Carsten Lemmen
Environmental Scientist

Helmholtz Zentrum Geesthacht
Centre for Materials and Coastal Research GmbH
Institute for Coastal Research - System Analysis & Modeling
Ecosystem Modeling (KSE)
Max-Planck-Str.1, 21502 Geesthacht, Germany

Tel.: +49 4152 87-2013 / Fax: -2020 / Secretary: -1526
Building 11, 1st floor, room 131
Email: carsten...@hzg.de
Internet: http://www.hzg.de
Messaging: skype://platipodium or aim://platipodium

My email is as private as regular mail, please 'put it in an envelope'
by GPG encryption with my public key id 9249e2e0.

Geschäftsführer: Prof. Dr. W. A. Kaysser, S. Simon Vors. d.
Aufsichtsrats: Min.-Dir. Dr. H. Zeisel, Amtsgericht Lübeck HRB 285 GE,
USt.IDNr.: DE 135 131 669
Helmholtz-Zentrum Geesthacht
Zentrum für Material- und Küstenforschung GmbH
Max-Planck-Straße 1 I 21502 Geesthacht I Deutschland/Germany

Geschäftsführung/Board of Management: Prof. Dr. Wolfgang Kaysser, Silke Simon
Vorsitzender des Aufsichtsrates/Chairman of the Supervisory Board: Ministerialdirigent Dr. Herbert Zeisel
Amtsgericht Lübeck HRB 285 GE (Register Court)
Internet: http://www.hzg.de

Jorn Bruggeman

unread,
Aug 17, 2019, 4:17:21 AM8/17/19
to fabm-...@googlegroups.com, Frank-Detle...@hzg.de
Hi Carsten,

Thanks! We've seen this before, e.g., with the hycom driver. To avoid the string comparison like in your patch (which would not catch alternate case, e.g., LOGICAL), we've added "#define _FABM_IS_UNMASKED_(maskvalue) maskvalue" in fabm_driver.h. That prevents FABM from doing the logical comparison altogether. Does that work for your case too?

Cheers,

Jorn
--
You received this message because you are subscribed to the Google Groups "FABM-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabm-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fabm-devel/4d322208-f643-cdf0-dbac-bb8273800568%40hzg.de.

Carsten Lemmen

unread,
Oct 14, 2019, 3:08:37 AM10/14/19
to fabm-...@googlegroups.com
Dear Jorn,

works like a charm :=) Thanks for the fix.

Cheers,

Carsten

Am 14.08.19 um 15:18 schrieb Jorn Bruggeman:
Phone (h): +49 4131 927 1020
Phone (w): +49 4152 87-2013
Phone (m): +49 176 4944 8685
Phone (m): +49 4131 927 9938

Messaging: skype://platipodium

Email (h): car...@familie-lemmen.de
Email (w): carsten...@hzg.de
Reply all
Reply to author
Forward
0 new messages