Skip to content

Pushing down _normalzationConstants array to threads #34

@robers97

Description

@robers97

The paper shows good scaling to 32 threads. I have been looking at 64, 128, and higher thread counts.
There gets to be some contention in arrays like _normalizationConstants which appears to be suited to live in the body of the thread for all of its life except perhaps the one call to garner statistics.

In addition, in Layer.cpp. this change to loop and then write was beneficial to gcc and helped reduce the sharing contention.

if(_type == NodeType::Softmax) {
    float accum = 0;
    for (int i = 0; i < len; i++) {
        float realActivation = exp(activeValuesperlayer[layerIndex + 1][i] - maxValue);
        activeValuesperlayer[layerIndex + 1][i] = realActivation;
        _Nodes[activenodesperlayer[layerIndex + 1][i]].SetlastActivation(inputID, realActivation);
        accum += realActivation;
    }
    _normalizationConstants[inputID] = accum;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions