Ejemplo n.º 1
0
        /// <summary>
        /// bitwise equivalence;
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if (obj.GetType() != typeof(MPI_Op))
            {
                return(false);
            }
            MPI_Op other = (MPI_Op)obj;

            return(other.m1 == this.m1);
        }
Ejemplo n.º 2
0
        private void LoadSymb(string name, ref MPI_Op sym)
        {
            string errstr;
            IntPtr addr = Utils.DynamicLibraries.LoadSymbol(m_conv.LibHandle, name, out errstr);

            if (addr == IntPtr.Zero)
            {
                throw new ApplicationException("OpenMPI error: unable to load symbol '" + name + "' from library '" + m_conv.CurrentLibraryName + "', Error string: >" + errstr + "<;");
            }
            //Console.WriteLine("val of '" + name + "' is: " + addr);
            sym.m1 = m_conv.MPI_Op_c2f(addr);
        }
Ejemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 public byte[] Op_f2c(MPI_Op F_Comm)
 {
     byte[] ret = new byte[this.GetSizeof_C_MPI_Op()];
     unsafe {
         byte *pComm = (byte *)&(F_Comm.m1);
         for (int i = 0; i < ret.Length; i++)
         {
             ret[i] = *pComm;
             pComm++;
         }
     }
     return(ret);
 }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        public MPI_Op Op_c2f(byte[] C_MPI_Comm)
        {
            if (C_MPI_Comm.Length != GetSizeof_C_MPI_Op())
            {
                throw new ArgumentException("wrong number of bytes; length of argument must match the value that is returend by 'GetSizeof_C_MPI_comm()';");
            }
            MPI_Op F_Comm = default(MPI_Op);

            unsafe
            {
                fixed(byte *pcComm = &C_MPI_Comm[0])
                {
                    byte *pComm = (byte *)&(F_Comm.m1);

                    for (int i = 0; i < C_MPI_Comm.Length; i++)
                    {
                        *pComm = pcComm[i];
                        pComm++;
                    }
                }
            }
            return(F_Comm);
        }
Ejemplo n.º 5
0
#pragma warning restore 649

        /// <summary>
        ///
        /// </summary>
        unsafe public void Allreduce(IntPtr sndbuf, IntPtr rcvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
        {
            int ierr;

            MPI_ALLREDUCE(sndbuf, rcvbuf, ref count, ref datatype, ref op, ref comm, out ierr);
            MPIException.CheckReturnCode(ierr);
        }
Ejemplo n.º 6
0
 public byte[] Op_f2c(MPI_Op F_Comm)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 7
0
        public byte[] Op_f2c(MPI_Op F_Op)
        {
            IntPtr c_op = m_conv.MPI_Op_f2c(F_Op);

            return(OPENMPI_Converter.IntPtr2ByteArray(c_op));
        }
Ejemplo n.º 8
0
#pragma warning restore 649

        /// <summary>
        ///
        /// </summary>
        public void Reduce(IntPtr sndbuf, IntPtr rcvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
        {
            using (new MPITracer()) {
                int ierr;
                MPI_REDUCE(sndbuf, rcvbuf, ref count, ref datatype, ref op, ref root, ref comm, out ierr);
                MPIException.CheckReturnCode(ierr);
            }
        }