Re: [OMPI devel] 1.4.4rc2 is up

2011-05-23 Thread Larry Baker

Jeff,

I get the following warning from "make" using the Intel 2011.3.174  
compilers on OpenMPI 1.4.3:


libtool: compile:  icc -DHAVE_CONFIG_H -I. -I../../opal/include - 
I../../orte/include -I../../ompi/include -I../../opal/mca/paffinity/ 
linux/plpa/src/libplpa -I../.. -DNDEBUG -g -O3 -finline-functions - 
fno-strict-aliasing -restrict -pthread -fvisibility=hidden -MT  
dt_module.lo -MD -MP -MF .deps/dt_module.Tpo -c dt_module.c  -fPIC - 
DPIC -o .libs/dt_module.o
dt_module.c(709): warning #1224: #warning directive: "No proper C  
type found for COMPLEX32"

  #   warning "No proper C type found for COMPLEX32"
  ^


The code in ompi/datatype/dt_module.c (lines 705-713; exactly the same  
in 1.4.4rc2) is:



#if OMPI_HAVE_FORTRAN_COMPLEX32
#if OMPI_REAL16_MATCHES_C && (OMPI_SIZEOF_FORTRAN_COMPLEX32 ==  
2*SIZEOF_LONG_DOUBLE)
DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_complex32.dt,  
"MPI_COMPLEX32", &ompi_mpi_ldblcplex.dt );

#else
#   warning "No proper C type found for COMPLEX32"
DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_complex32.dt,  
"MPI_COMPLEX32", &ompi_mpi_unavailable.dt );

#endif
ompi_mpi_complex32.dt.flags |= DT_FLAG_DATA_FORTRAN |  
DT_FLAG_DATA_COMPLEX;

#endif /* OMPI_HAVE_FORTRAN_COMPLEX32 */



I see from configure, that the Intel compilers support REAL*16 and  
COMPLEX*32, but the representations are different between the C and  
Fortran compilers:



checking if REAL*16 matches bit representation of long double... no
configure: WARNING: MPI_REAL16 and MPI_COMPLEX32 support have been  
disabled


I have two observations:

1) Despite the message saying so, configure does not in fact disable  
MPI_REAL16 and MPI_COMPLEX32 support; the code in ompi/datatype/ 
dt_module.c happens to catch the error.  From opal/include/ 
opal_config.h:



#define OMPI_ALIGNMENT_FORTRAN_COMPLEX32 1



#define OMPI_ALIGNMENT_FORTRAN_REAL16 1
#define OMPI_HAVE_F90_COMPLEX32 1
#define OMPI_HAVE_F90_REAL16 1
#define OMPI_HAVE_FORTRAN_COMPLEX32 1
#define OMPI_HAVE_FORTRAN_REAL16 1
#define OMPI_REAL16_MATCHES_C 0
#define OMPI_SIZEOF_FORTRAN_COMPLEX32 32
#define OMPI_SIZEOF_FORTRAN_REAL16 16



2) ompi/datatype/dt_module.c does not catch the same error for the  
incompatible REAL*16 datatype (lines 609-617):



#if OMPI_HAVE_FORTRAN_REAL16
#if (OMPI_SIZEOF_FORTRAN_REAL16 == SIZEOF_LONG_DOUBLE) <-- should be  
#if OMPI_REAL16_MATCHES_C && (OMPI_SIZEOF_FORTRAN_REAL16 ==  
SIZEOF_LONG_DOUBLE)
DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_real16.dt, "MPI_REAL16",  
&ompi_mpi_long_double.dt );

#else
#   warning "No proper C type found for REAL16"
DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_real16.dt, "MPI_REAL16",  
&ompi_mpi_unavailable.dt );

#endif
ompi_mpi_real16.dt.flags |= DT_FLAG_DATA_FORTRAN |  
DT_FLAG_DATA_FLOAT;

#endif /* OMPI_HAVE_FORTRAN_REAL16 */



I do not like make warnings.  configure determines that the REAL*16  
and COMPLEX*32 datatypes are incompatible, but then does not actually  
disable them, despite saying it did.  I like defensive code.  The  
COMPLEX*32 datatype protection needs to be applied to the REAL*16  
datatype as well in ompi/datatype/dt_module.c.


Larry Baker
US Geological Survey
650-329-5608
ba...@usgs.gov

On 5 May 2011, at 7:15 AM, Jeff Squyres wrote:

Fixed the ROMIO attribute problem properly this time -- it's in the  
usual place:


   http://www.open-mpi.org/software/ompi/v1.4/

--
Jeff Squyres
jsquy...@cisco.com
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/


___
devel mailing list
de...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/devel




Re: [OMPI devel] 1.4.4rc2 is up

2011-05-23 Thread Larry Baker

Jeff,

I get the following warnings from "make" using the Intel 2011.3.174  
compilers on OpenMPI 1.4.3:






btl_openib_endpoint.c(319): warning #188: enumerated type mixed with  
another type
btl_openib_async.c(411): warning #188: enumerated type mixed with  
another type
btl_openib_async.c(454): warning #188: enumerated type mixed with  
another type
btl_openib_async.c(472): warning #188: enumerated type mixed with  
another type
btl_openib_async.c(510): warning #188: enumerated type mixed with  
another type
connect/btl_openib_connect_oob.c(289): warning #188: enumerated type  
mixed with another type
connect/btl_openib_connect_xoob.c(462): warning #188: enumerated  
type mixed with another type
connect/btl_openib_connect_xoob.c(563): warning #188: enumerated  
type mixed with another type



These are all warnings caused by mixing enums and ints as though they  
were interchangeable.  This concerns me, because, one can mistakenly  
assume the only possible values of an enum data type are the range of  
valid enum constants.  That can make debugging such errors very  
difficult.  I do not know if you are aware of these.


I found the following:

1) ompi/mca/btl/openib/btl_openib/btl_openib_endpoint.c(319): warning  
#188: enumerated type mixed with another type:


ep->rem_info.rem_transport_type = (remote_proc_info- 
>pm_port_info).transport_type;



The left side is an enum mca_btl_openib_transport_type_t (from ompi/ 
mca/btl/openib/btl_openib.h):



/**
 * Infiniband (IB) BTL component.
 */

typedef enum {
MCA_BTL_OPENIB_TRANSPORT_IB,
MCA_BTL_OPENIB_TRANSPORT_IWARP,
MCA_BTL_OPENIB_TRANSPORT_RDMAOE,
MCA_BTL_OPENIB_TRANSPORT_UNKNOWN,
MCA_BTL_OPENIB_TRANSPORT_SIZE
} mca_btl_openib_transport_type_t;



, while the right side is a uint8_t (also from ompi/mca/btl/openib/ 
btl_openib.h):



/**
 * Common information for all ports that is sent in the modex message
 */
typedef struct mca_btl_openib_modex_message_t {
/** The subnet ID of this port */
uint64_t subnet_id;
/** LID of this port */
uint16_t lid;
/** APM LID for this port */
uint16_t apm_lid;
/** The MTU used by this port */
uint8_t mtu;
/** vendor id define device type and tuning */
uint32_t vendor_id;
/** vendor part id define device type and tuning */
uint32_t vendor_part_id;
/** Transport type of remote port */
uint8_t transport_type;
/** Dummy field used to calculate the real length */
uint8_t end;
} mca_btl_openib_modex_message_t;


I would think mca_btl_openib_modex_message_t.transport_type should be  
a compatible enum as well.  At least there should be some code  
somewhere with asserts or validity checks in, say, a switch block when  
DEBUG=1, and a cast otherwise.


2) ompi/mca/btl/openib/btl_openib/btl_openib_async.c(411): warning  
#188: enumerated type mixed with another type, and
ompi/mca/btl/openib/btl_openib_async.c(454): warning #188: enumerated  
type mixed with another type:



static ... ( ... enum ibv_qp_attr_mask *mask ... )
{



*mask = IBV_QP_ALT_PATH|IBV_QP_PATH_MIG_STATE;



ompi/mca/btl/openib/btl_openib_async.c(472): warning #188: enumerated  
type mixed with another type, and
ompi/mca/btl/openib/btl_openib_async.c(510): warning #188: enumerated  
type mixed with another type:



enum ibv_qp_attr_mask mask = 0;



These four warnings are all due to mixing the definition of bitfields  
using a C enum type (from /usr/include/infiniband/verbs.h):



enum ibv_qp_attr_mask {
IBV_QP_STATE= 1 <<  0,
IBV_QP_CUR_STATE= 1 <<  1,
IBV_QP_EN_SQD_ASYNC_NOTIFY  = 1 <<  2,
IBV_QP_ACCESS_FLAGS = 1 <<  3,
IBV_QP_PKEY_INDEX   = 1 <<  4,
IBV_QP_PORT = 1 <<  5,
IBV_QP_QKEY = 1 <<  6,
IBV_QP_AV   = 1 <<  7,
IBV_QP_PATH_MTU = 1 <<  8,
IBV_QP_TIMEOUT  = 1 <<  9,
IBV_QP_RETRY_CNT= 1 << 10,
IBV_QP_RNR_RETRY= 1 << 11,
IBV_QP_RQ_PSN   = 1 << 12,
IBV_QP_MAX_QP_RD_ATOMIC = 1 << 13,
IBV_QP_ALT_PATH = 1 << 14,
IBV_QP_MIN_RNR_TIMER= 1 << 15,
IBV_QP_SQ_PSN   = 1 << 16,
IBV_QP_MAX_DEST_RD_ATOMIC   = 1 << 17,
IBV_QP_PATH_MIG_STATE   = 1 << 18,
IBV_QP_CAP  = 1 << 19,
IBV_QP_DEST_QPN = 1 << 20
};



The warning is really an error, since neither the right hand side  
"IBV_QP_ALT_PATH|IBV_QP_PATH_MIG_STATE" nor "0" is one of the enum  
ibv_qp_attr_mask values, and is therefore not a valid member of that  
data type.  I'm not really sure there is a better way, since C does  
not guarantee the order of bitfields.  Anyway, since C permits enums  
to be used wherever ints can be used, the right hand side