<commit_before>#!/usr/bin/env julia

using Base.Threads, FLoops

function _picalc(numsteps)
    slice = 1.0 / numsteps

    @floop @simd for i = 1:numsteps
        x = (i - 0.5) * slice
        @reduce(sum += 4.0 / (1.0 + x ^ 2))
    end

    return sum * slice
end

function picalc(numsteps)

    println("Calculating PI using:")
    println("  ", numsteps, " slices")
    println("  ", nthreads(), " thread(s)")

    start = time()
    mypi = _picalc(numsteps)<commit_msg>Set `basesize` for threaded executor of Julia FLoops example<commit_after>#!/usr/bin/env julia

using Base.Threads, FLoops

function _picalc(numsteps)
    slice = 1.0 / numsteps

    @floop ThreadedEx(;simd=true, basesize=numsteps÷1000) for i = 1:numsteps
        x = (i - 0.5) * slice
        @reduce(sum += 4.0 / (1.0 + x ^ 2))
    end

    return sum * slice
end

function picalc(numsteps)

    println("Calculating PI using:")
    println("  ", numsteps, " slices")
    println("  ", nthreads(), " thread(s)")

    start = time()
    mypi = _picalc(numsteps)
{'fraction_non_alphanumeric': 0.14478764478764478, 'fraction_numerical': 0.023166023166023165, 'mean_word_length': 2.7846715328467155, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4604100', 'n_tokens_mistral': 413, 'n_tokens_neox': 376, 'n_words': 96}