Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for BEFORE/AFTER block #979

Merged
merged 7 commits into from
Jan 12, 2023
Merged

Conversation

alkino
Copy link
Member

@alkino alkino commented Dec 1, 2022

Should fix #946

@ohm314
Copy link
Contributor

ohm314 commented Dec 5, 2022

@alkino did you see the spack failure on the bbpgitlab CI? Maybe it has something to do with the updated neuron@develop that was mentioned today? I think once this hickup is fixed and maybe the tests are just a little bit expanded we can merge this.

@alkino alkino closed this Dec 6, 2022
@alkino alkino reopened this Dec 6, 2022
@alkino alkino force-pushed the cornu/more_test_for_before_after branch from 39c0c98 to e8559f4 Compare December 6, 2022 09:19
@alkino alkino force-pushed the cornu/more_test_for_before_after branch from b32fc9e to 69a442d Compare January 6, 2023 13:19
@alkino alkino force-pushed the cornu/more_test_for_before_after branch from 69a442d to 28132b9 Compare January 6, 2023 13:32
@bbpbuildbot
Copy link
Collaborator

Logfiles from GitLab pipeline #93370 (:white_check_mark:) have been uploaded here!

Status and direct links:

@alkino
Copy link
Member Author

alkino commented Jan 9, 2023

@iomaganaris @ohm314

The generated code is verbose.

BEFORE INITIAL {
  init()
  inc = 0
  bi = inc
  bit = t
  printf("ba0 BEFORE INITIAL inc=%g t=%g\n", inc, t)
}

generate:

/** BEFORE of block type INITIAL # 0 */
void nrn_before_after_0_ba0(NrnThread* nt, Memb_list* ml, int type) {
    int nodecount = ml->nodecount;
    int pnodecount = ml->_nodecount_padded;
    const int* node_index = ml->nodeindices;
    double* data = ml->data;
    const double* voltage = nt->_actual_v;
    Datum* indexes = ml->pdata;
    ThreadDatum* thread = ml->_thread;
    auto* const inst = static_cast<ba0_Instance*>(ml->instance);

    #pragma ivdep
    #pragma omp simd
    for (int id = 0; id < nodecount; id++) {
        int node_id = node_index[id];
        double v = voltage[node_id];
        #if NRN_PRCELLSTATE
        inst->v_unused[id] = v;
        #endif
        {
            init_ba0(id, pnodecount, inst, data, indexes, thread, nt, v);
            inst->inc[id] = 0.0;
            inst->bi[id] = inst->inc[id];
            inst->bit[id] = nt->_t;
            printf("ba0 BEFORE INITIAL inc=%g t=%g\n", inst->inc[id], nt->_t);
        }
    }
}

I'm not sure what to test there

@ohm314
Copy link
Contributor

ohm314 commented Jan 10, 2023

Maybe it's enough to have

BEFORE INITIAL {
  init()
  inc = 0
}

and make sure we find this loop in the output:

#pragma ivdep
#pragma omp simd
for (int id = 0; id < nodecount; id++) {
    int node_id = node_index[id];
    double v = voltage[node_id];
    #if NRN_PRCELLSTATE
    inst->v_unused[id] = v;
    #endif
    {
        init_ba0(id, pnodecount, inst, data, indexes, thread, nt, v);
        inst->inc[id] = 0.0;
    }
}

Copy link
Contributor

@pramodk pramodk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks!

If CI passes, good to go!

test/unit/codegen/codegen_cpp_visitor.cpp Show resolved Hide resolved
@bbpbuildbot
Copy link
Collaborator

Logfiles from GitLab pipeline #94403 (:white_check_mark:) have been uploaded here!

Status and direct links:

@bbpbuildbot
Copy link
Collaborator

Logfiles from GitLab pipeline #94618 (:white_check_mark:) have been uploaded here!

Status and direct links:

@alkino alkino merged commit ac27278 into master Jan 12, 2023
@alkino alkino deleted the cornu/more_test_for_before_after branch January 12, 2023 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement BEFORE / AFTER blocks
5 participants