예제 #1
0
            public void sumoverthreadsandmpi()
            {
                for (int ThreadNo = 0; ThreadNo < NumberofThreads; ThreadNo++)
                {
                    if (IndexValue[ThreadNo] < 0)
                    {
                        continue;
                    }

                    TotalNumberofPoints += NumberofPoints[ThreadNo];
                    if (MinMaxPointer != 0)
                    {
                        if ((TotalIndexValue >= 0) && (TotalMaxOrMin > MaxOrMinvalue[ThreadNo]))
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if ((TotalIndexValue >= 0) && (TotalMaxOrMin <= MaxOrMinvalue[ThreadNo]))
                        {
                            continue;
                        }
                    }

                    TotalMaxOrMin   = MaxOrMinvalue[ThreadNo];
                    TotalIndexValue = IndexValue[ThreadNo];
                }
                if (DAVectorUtility.MPI_Size > 1)
                {
                    DAVectorUtility.StartSubTimer(DAVectorUtility.MPIREDUCETiming1);
                    if (MinMaxPointer != 0)
                    {
                        DAVectorUtility.AllReduceMaxWithIndex(ref TotalMaxOrMin, ref TotalIndexValue);
                    }
                    else
                    {
                        DAVectorUtility.AllReduceMinWithIndex(ref TotalMaxOrMin, ref TotalIndexValue);
                    }
                    TotalNumberofPoints = DAVectorUtility.MPI_communicator.Allreduce <double>(TotalNumberofPoints, Operation <double> .Add);
                    DAVectorUtility.StopSubTimer(DAVectorUtility.MPIREDUCETiming1);
                }
                return;
            }