Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Conversation

@alkino
Copy link
Member

@alkino alkino commented Feb 12, 2020

No description provided.

@bbpbuildbot
Copy link
Collaborator

Can one of the admins verify this patch?

@alkino alkino mentioned this pull request Feb 12, 2020
18 tasks
@alkino alkino changed the base branch from master to test_in_binaryDir February 12, 2020 12:34
Copy link
Contributor

@ohm314 ohm314 left a comment

Choose a reason for hiding this comment

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

More a general question. I totally agree that we should through out the trash so to say, but I'm wondering if some of these #if 0 code blocks should not go into #if _DEBUG. @pramodk any opinion on that?

@alkino
Copy link
Member Author

alkino commented Feb 13, 2020

If you enable #if DEBUG it does not compile anymore...

@pramodk
Copy link
Collaborator

pramodk commented Feb 14, 2020

@pramodk any opinion on that?

Yeah I believe we have to move certain code we have to move under DEBUG. I can comment inn details.

If you enable #if DEBUG it does not compile anymore...

We have to fix that! I can help. We should have one of the travis build compiled with DEBUG enabled.

@alkino
Copy link
Member Author

alkino commented Feb 14, 2020

We have to switch to spdlog and put #if DEBUG in spdlog::debug

@alkino alkino changed the base branch from test_in_binaryDir to master February 20, 2020 08:29
@alkino
Copy link
Member Author

alkino commented Feb 20, 2020

Endly, I put only what cannot go inside #if DEBUG.

Make a fine review please.

Due to #if 0, if (0 && ...) and #if 1 ||
Copy link
Contributor

@ohm314 ohm314 left a comment

Choose a reason for hiding this comment

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

looks good, except for one function

}

// size of groups with contiguous parents for each level
static void question(VVTN& levels) {
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the use of an empty function?

Copy link
Member Author

Choose a reason for hiding this comment

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

good question.
This function has been #if 0 since at least: 2016-10-05

Copy link
Member Author

Choose a reason for hiding this comment

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

172 files changed, 18126 insertions(+), 7038 deletions(-)
It was an impressive commit by Pramod!

Copy link
Contributor

Choose a reason for hiding this comment

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

let's toss it out

Copy link
Collaborator

Choose a reason for hiding this comment

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

@ohm314 @alkino :

It was an impressive commit by Pramod!

that was a gpu development branch being worked for a year or so and then it was merged together and thats why those stats.

This function has been #if 0 since at least: 2016-10-05

we need to discuss a bit about dead code aka #if 0. Lets take an example of :

void chklevel(VTN& level, size_t nident = 8) {
 #if 0
   nrn_assert(level.size() % nident == 0);
   for (size_t i = 0; i <  level.size(); ++i) {
     size_t j = nident*int(i/nident);
     nrn_assert(level[i]->hash == level[j]->hash);
   }
 #endif
 }

In this case when we perform permutations/reordering of morphological trees, this routine is helpful to verify if identical sub-trees are ordered together. Ideally, there could be a flag/option to perform such checks at runtime. But, in the past CMake build or CLI11 options were minimal and hence such code was just added in #if 0 (and whenever you have to verify something, it was turned on).

For such cases, today one could add some build/cli option to turn on such checks that can be very helpful to identify performance/logical errors.

So I would suggest to review if there are any utility functions and how they can be incorporated rather than just removing it (I think there are few such cases in this PR).

Copy link
Contributor

Choose a reason for hiding this comment

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

In this case we should introduce a macro _DEBUG_GPU and ifdef this. if 0 should always mean "delete me".

@ohm314 ohm314 merged commit ca97c39 into master Feb 20, 2020
@pramodk
Copy link
Collaborator

pramodk commented Feb 20, 2020

Sorry, I didnt get time to review this. I believe there are certain changes in this PR need to be handled differently. I will create separate ticket or PR to address that.

@alkino alkino deleted the remove_dead_code branch March 16, 2020 07:24
pramodk pushed a commit to neuronsimulator/nrn that referenced this pull request Nov 2, 2022
* Remove dead code put in DEBUG what should be

Due to #if 0, if (0 && ...) and #if 1 ||

* Remove empty function question

CoreNEURON Repo SHA: BlueBrain/CoreNeuron@ca97c39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants