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

ITK_GLOBAL_NUMBER_OF_THREADS is ignored #390

Closed
muratmaga opened this issue Jan 24, 2024 · 2 comments
Closed

ITK_GLOBAL_NUMBER_OF_THREADS is ignored #390

muratmaga opened this issue Jan 24, 2024 · 2 comments

Comments

@muratmaga
Copy link

I am trying to do measure performance scaling for a project and this code executes pretty much the same amount of time regardless of what I set the ITK_GLOBAL_NUMBER_OF_THREADS to. I tried setting in R with Sys.setenv and also in shell prior to starting R. Both had no effect

fi <- antsImageRead(getANTsRData("r16") ) %>% resampleImage(., c(1024, 1024), useVoxels = TRUE)
mi <- antsImageRead(getANTsRData("r64") ) %>% resampleImage(., c(1024, 1024), useVoxels = TRUE)

f=function(X) {
  antsRegistration(fi, mi, "SyNOnly",  
                   synMetric="CC", 
                   synSampling=4, synits="0x0x0x1000", 
                   smoothingsigmas="3x2x1x0" 
                   shrinkfactors="4x3x2x1")
}
  
cores=c(64, 32, 16, 8, 4)

time=NULL
for (i in cores){
Sys.setenv(ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=i)
tt=Sys.time()
f(i)
time=rbind(time, cbind(i, Sys.time()-tt))
}

This is not a big deal for me, as I typically prefer to use the full number of cores. I wanted to let people now.

@dorianps
Copy link
Collaborator

dorianps commented Jan 24, 2024 via email

@muratmaga
Copy link
Author

Thanks. I retried with the using the terminal window in the Rstudio, and yes setting the variable prior to starting R works.

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

No branches or pull requests

2 participants