-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
parallel computing in cv_iht
is slow for floating point matrices.
#8
Comments
I agree that it might be oversubscription with |
The advice I got was to |
Just in case you are planning to add that line to the main package (under |
With recent changes in cross validation, this issue is resolved (it may have been resolved a long time ago but I never checked). MWE using MendelIHT, Random, SnpArrays, GLM, LinearAlgebra
BLAS.set_num_threads(1)
Random.seed!(1111)
n = 1000
p = 10000
k = 10
d = Normal
l = IdentityLink()
# simulate genotypes and nongenetic covariate
x = randn(n, p)
z = ones(n, 2)
z[:, 2] .= rand(0:1, n)
standardize!(@view(z[:, 2:end]))
# randomly set genetic predictors where causal βᵢ ~ N(0, 1)
true_b = zeros(p)
true_b[1:k-2] = randn(k-2)
shuffle!(true_b)
# define effect size of non-genetic predictors: intercept & sex
true_c = [1.0; 1.5]
# simulate phenotype using genetic and nongenetic predictors
prob = GLM.linkinv.(l, x * true_b .+ z * true_c) # note genotype-vector multiplication is done with `xla`
y = [rand(d(i)) for i in prob]
@time mses = cv_iht(y, x, z, path=1:20, verbose=false);
@time mses = cv_iht(y, x, z, path=1:20, verbose=false);
1 thread: 21.393467 seconds (87.84 M allocations: 3.032 GiB, 3.15% gc time)
10.813218 seconds (52.30 M allocations: 1.065 GiB, 1.53% gc time) 4 threads 13.381170 seconds (88.03 M allocations: 3.043 GiB, 4.44% gc time)
3.201153 seconds (52.76 M allocations: 1.079 GiB, 6.05% gc time) 8 threads 12.632355 seconds (89.10 M allocations: 3.089 GiB, 4.85% gc time)
2.277163 seconds (52.36 M allocations: 1.069 GiB, 5.31% gc time) |
In your instructions, you state
but if I have only loaded MendelIHT, then the suggested command does not work:
I thought this meant that I needed to install the BLAS package, which surprised me as MendelIHT is running fine. Looks like I just need to load
Consider clarifying this in your instructions re how to turn threading on. Thanks, |
As noted, currently the parallel computing part for the cross validation routine is slower than single core. I don't really know why at the moment, but I suspect it is caused oversubscription with
pmap
and BLAS mixed together..For the moment, use
parallel = false
when you are using single/double-precision matrices.The text was updated successfully, but these errors were encountered: