예제 #1
0
    double DoNNET(NNetStruct locnnetstruct)
    {
        //    string errorcontext = "CPU:NNET";
        //    int systemerror = 0;
        long   accumtime  = 0;
        double iterations = 0.0;

        /*
        ** Init random number generator.
        ** NOTE: It is important that the random number generator
        **  be re-initialized for every pass through this test.
        **  The NNET algorithm uses the random number generator
        **  to initialize the net.  Results are sensitive to
        **  the initial neural net state.
        */
        ByteMark.randnum(3);

        /*
        ** Read in the input and output patterns.  We'll do this
        ** only once here at the beginning.  These values don't
        ** change once loaded.
        */
        read_data_file();

        /*
        ** See if we need to perform self adjustment loop.
        */
        if (locnnetstruct.adjust == 0)
        {
            /*
            ** Do self-adjustment.  This involves initializing the
            ** # of loops and increasing the loop count until we
            ** get a number of loops that we can use.
            */
            for (locnnetstruct.loops = 1;
                 locnnetstruct.loops < MAXNNETLOOPS;
                 locnnetstruct.loops++)
            {
                ByteMark.randnum(3);
                if (DoNNetIteration(locnnetstruct.loops) > global.min_ticks)
                {
                    break;
                }
            }
        }

        /*
        ** All's well if we get here.  Do the test.
        */
        accumtime  = 0L;
        iterations = (double)0.0;

        do
        {
            ByteMark.randnum(3);    /* Gotta do this for Neural Net */
            accumtime  += DoNNetIteration(locnnetstruct.loops);
            iterations += (double)locnnetstruct.loops;
        } while (ByteMark.TicksToSecs(accumtime) < locnnetstruct.request_secs);

        /*
        ** Clean up, calculate results, and go home.  Be sure to
        ** show that we don't have to rerun adjustment code.
        */
        locnnetstruct.iterspersec = iterations / ByteMark.TicksToFracSecs(accumtime);

        if (locnnetstruct.adjust == 0)
        {
            locnnetstruct.adjust = 1;
        }


        return(locnnetstruct.iterspersec);
    }
예제 #2
0
파일: neural.cs 프로젝트: CheneyWu/coreclr
    double DoNNET(NNetStruct locnnetstruct)
    {
        //    string errorcontext = "CPU:NNET";
        //    int systemerror = 0;
        long accumtime = 0;
        double iterations = 0.0;

        /*
        ** Init random number generator.
        ** NOTE: It is important that the random number generator
        **  be re-initialized for every pass through this test.
        **  The NNET algorithm uses the random number generator
        **  to initialize the net.  Results are sensitive to
        **  the initial neural net state.
        */
        ByteMark.randnum(3);

        /*
        ** Read in the input and output patterns.  We'll do this
        ** only once here at the beginning.  These values don't
        ** change once loaded.
        */
        read_data_file();

        /*
        ** See if we need to perform self adjustment loop.
        */
        if (locnnetstruct.adjust == 0)
        {
            /*
            ** Do self-adjustment.  This involves initializing the
            ** # of loops and increasing the loop count until we
            ** get a number of loops that we can use.
            */
            for (locnnetstruct.loops = 1;
                locnnetstruct.loops < MAXNNETLOOPS;
                locnnetstruct.loops++)
            {
                ByteMark.randnum(3);
                if (DoNNetIteration(locnnetstruct.loops) > global.min_ticks)
                    break;
            }
        }

        /*
        ** All's well if we get here.  Do the test.
        */
        accumtime = 0L;
        iterations = (double)0.0;

        do
        {
            ByteMark.randnum(3);    /* Gotta do this for Neural Net */
            accumtime += DoNNetIteration(locnnetstruct.loops);
            iterations += (double)locnnetstruct.loops;
        } while (ByteMark.TicksToSecs(accumtime) < locnnetstruct.request_secs);

        /*
        ** Clean up, calculate results, and go home.  Be sure to
        ** show that we don't have to rerun adjustment code.
        */
        locnnetstruct.iterspersec = iterations / ByteMark.TicksToFracSecs(accumtime);

        if (locnnetstruct.adjust == 0)
            locnnetstruct.adjust = 1;


        return locnnetstruct.iterspersec;
    }