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

Combinatorial Iterators not working parallel #26

Open
elephann opened this issue Mar 13, 2022 · 2 comments
Open

Combinatorial Iterators not working parallel #26

elephann opened this issue Mar 13, 2022 · 2 comments
Assignees

Comments

@elephann
Copy link

elephann commented Mar 13, 2022

I was working a full search of Combinatorial caculation, the population about 4000, and I want to find 2 or 3 Combinatorial that satisfy certain condition. I thought RcppAlgos might help, but when I parallel , it not working!
example:
select_n_shr=2
shrs=1:4000
itc <- comboIter(shrs, select_n_shr)

AllPairs <- foreach(i = itc, .packages = c("data.table","urca","vars"), .combine = 'rbind') %dopar% {
print(i)}
the output:

AllPairs
[1] 1 2

@jwood000
Copy link
Owner

Hello @elephann,

In order for a general iterator to be compatible with the foreach package, the iterator must be set up with special classes.

Currently the iterators in RcppAlgos are not compatible with foreach and the like. There is ongoing research to address this topic in later releases.

See for example: https://cran.r-project.org/web/packages/iterators/vignettes/writing.pdf

Thanks,
Joseph

@jwood000 jwood000 self-assigned this Mar 17, 2022
@elephann
Copy link
Author

Oh! Anyway, thanks, great work!~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants