Aug.18.2018 -- CAlive to introduce synching parallel fp/integer blocks

11 views
Skip to first unread message

Rick C. Hodgin

unread,
Aug 18, 2018, 10:31:19 AM8/18/18
to CAlive Programming Language
CAlive will introduce the ability to create brief synchronizing blocks of parallel code to operate on separate integer and floating point blocks, designed to schedule single-core multi-thread instruction streams in parallel when the integer and floating point portion do not overlap.

They keywords fp and integer are given to allow two process threads to run in parallel, with the optional sync trailing keyword to cause whichever one completes first to wait until the other one catches up before proceeding.

    function name
    | params int a, int b
    | returns int r
    {
        f64 f1, f2, fi;

        // Start two instruction streams, one on fp, one on integer
        parallel fp
        {
            // Perform memory and/or floating point ops here
            f1 = (f64)a * (f64)b;
            for (fi = 0.0, f2 = 0.0; i < 200.0; ++fi)
            {
                f2 += f1;
                f1 *= 2.0;
            }

        } integer {
            // Perform memory and/or integer ops here
            r = (a + b) * (a * b) * (a * b);

        } sync;

        // Store the final result
        r /= (f1 + f2);
    }

--
Rick C. Hodgin

Reply all
Reply to author
Forward
0 new messages