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

NNPACK convolution issue #203

Closed
Alexander-Barth opened this issue Jun 1, 2020 · 4 comments
Closed

NNPACK convolution issue #203

Alexander-Barth opened this issue Jun 1, 2020 · 4 comments

Comments

@Alexander-Barth
Copy link
Contributor

The convolution with NNPACK do not seem to work reliably. The output of all these convolutions should be zero. Sometimes they are, but sometimes they have a strange value (maybe uninitialized memory)? Is this a known issue?

Thanks

julia> @time extrema(NNlib.conv(zeros(Float32,100,100,10,32),ones(Float32,4,4,10,10)))
  0.044346 seconds (44 allocations: 23.707 MiB)
(0.0f0, 0.0f0)

julia> @time extrema(NNlib.conv(zeros(Float32,100,100,10,32),ones(Float32,4,4,10,10)))
  0.043753 seconds (44 allocations: 23.707 MiB)
(0.0f0, 0.0f0)

julia> @time extrema(NNlib.conv(zeros(Float32,100,100,10,32),ones(Float32,4,4,10,20)))
  0.055470 seconds (44 allocations: 35.205 MiB)
(NaN32, NaN32)

julia> @time extrema(NNlib.conv(zeros(Float32,100,100,10,32),ones(Float32,4,4,10,30)))
  0.197568 seconds (144.16 k allocations: 54.368 MiB)
(-0.00033701234f0, 2.953125f0)

julia> NNlib.is_nnpack_available()
true

julia> NNlib.NNPACK_CPU_THREADS
0x0000000000000008

julia> NNlib.libnnpack
"/home/abarth/.julia/dev/NNlib/deps/usr/lib/libnnpack.so"


@ljluestc
Copy link

Ensure that NNPACK is installed correctly by checking that the library path is correct (/home/abarth/.julia/dev/NNlib/deps/usr/lib/libnnpack.so). Make sure you have the latest version of NNPACK installed, as newer versions may contain bug fixes and improvements.

NNlib.NNPACK_CPU_THREADS appears to be 0x0000000000000008. This value corresponds to 8 CPU threads. You might want to verify that it matches your system configuration.

@Alexander-Barth
Copy link
Contributor Author

Thank you for your input!
For some reasons the loading now fails on my system:

julia> using NNPACK_jll

julia> using NNlib
┌ Warning: Error requiring `NNPACK_jll` from `NNlib`
│   exception =
│    LoadError: ArgumentError: Package NNlib does not have NNPACK_jll in its dependencies:
│    - You may have a partially installed environment. Try `Pkg.instantiate()`
│      to ensure all packages in the environment are installed.
│    - Or, if you have NNlib checked out for development and have
│      added NNPACK_jll as a dependency but haven't updated your primary
│      environment's manifest file, try `Pkg.resolve()`.
│    - Otherwise you may need to report an issue with NNlib
│    Stacktrace:
│      [1] macro expansion
│        @ ./loading.jl:1599 [inlined]
│      [2] macro expansion
│        @ ./lock.jl:267 [inlined]
│      [3] require(into::Module, mod::Symbol)
│        @ Base ./loading.jl:1576
│      [4] include(mod::Module, _path::String)
│        @ Base ./Base.jl:457
│      [5] include(x::String)
│        @ NNlib ~/.julia/packages/NNlib/uuZgJ/src/NNlib.jl:1

If I am not mistaken, I use the latested version (in an empty envorinement).

(foo2) pkg> st
Status `/tmp/foo2/Project.toml`
  [872c559c] NNlib v0.9.1
  [a6bfbf70] NNPACK_jll v2018.6.22+0

Yes, I used 8 CPU cores on the system where I submitted the bug report. I included this info, as it could be potentially a multi-threading issue.

I am wondering of NNLib still uses NNPACK as it is not mentioned here:

https://github.com/FluxML/NNlib.jl/blob/master/Project.toml

@ToucheSir
Copy link
Member

Technically we still have some NNPACK routines hidden behind Requires, but I don't know of a single person who uses them and they probably should've been removed in v0.9.

@Alexander-Barth
Copy link
Contributor Author

OK, so as NNlib.conv gives the correct results, I think we can close the issue.

julia> extrema(NNlib.conv(zeros(Float32,100,100,10,32),ones(Float32,4,4,10,10)))
(0.0f0, 0.0f0)

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

3 participants