GithubHelp home page GithubHelp logo

Installation on Windows 10 about ffcv HOT 3 CLOSED

libffcv avatar libffcv commented on June 26, 2024
Installation on Windows 10

from ffcv.

Comments (3)

GuillaumeLeclerc avatar GuillaumeLeclerc commented on June 26, 2024

Hello,

Unfortunately none of us own a windows machine so it will be hard for us to help troubleshoot this. We did not intend to support Windows in the first place.

We use pkg-config to find the paths to the libturbojpeg and opencv libraries. You could craft your own setup.py with the correct paths to these libraries.

Hope it helps :/

from ffcv.

kynk94 avatar kynk94 commented on June 26, 2024

I built ffcv successfully with my Windows 10 PC
This is the installation process I did.

Install opencv (https://opencv.org/releases/)
After install opencv, move to C:/opencv

Install libjpeg-turbo (https://sourceforge.net/projects/libjpeg-turbo/)
download libjpeg-turbo-x.x.x-vc64.exe, not gcc64

Install pthread (https://www.sourceware.org/pthreads-win32/)
I downloaded pthreads-w32-2-9-1-release.zip
After unzip, rename Pre-build.2 folder to pthread and move to C:/pthread

And install mingw.

We need to configure .pc file of above packages to find them with pkg-config.
pkg-config .pc files path: C:/msys64/mingw64/lib/pkgconfig

create and paste below files to pkg-config path

# opencv4.pc 

prefix=c:/opencv/build
exec_prefix=c:/opencv/build
libdir=c:/opencv/build/x64/vc15/lib
includedir=c:/opencv/build/include

Name: OpenCV
Description: Open Source Computer Vision Library
Version: 4.5.5
Libs: -Lc:/opencv/build/x64/vc15/lib -lopencv_world455
Cflags: -Ic:/opencv/build/include
# libturbojpeg.pc

prefix=c:/libjpeg-turbo64
exec_prefix=c:/libjpeg-turbo64
libdir=c:/libjpeg-turbo64/lib
includedir=c:/libjpeg-turbo64/include

Name: libturbojpeg
Description: A SIMD-accelerated JPEG codec that provides the TurboJPEG API
Version: 2.1.2
Libs: -Lc:/libjpeg-turbo64/lib -lturbojpeg
Cflags: -Ic:/libjpeg-turbo64/include
# pthread.pc

Name: Pthread
Description: Pthread
Version: VC2
Libs: -LC:/pthread/lib/x64 -lpthreadVC2
Cflags: -IC:/pthread/include

Now pkg-config can recognize opencv4, libturbojpeg, pthread.

In setup.py, add extension_kwargs = pkgconfig('pthread', extension_kwargs)
and mute extension_kwargs['libraries'].extend(['pthread']), like below.

# setup.py
...
extension_kwargs = pkgconfig('opencv4', extension_kwargs)
extension_kwargs = pkgconfig('libturbojpeg', extension_kwargs)
extension_kwargs = pkgconfig('pthread', extension_kwargs)  # add this line.

# extension_kwargs['libraries'].extend(['pthread'])  # mute this line.
...

In libffcv/libffcv.cpp remove dunder from dunder uint in imdecode

// libffcv/libffcv.cpp
    int imdecode(unsigned char *input_buffer, uint64_t input_size,
                 uint32_t source_height, uint32_t source_width,
                 unsigned char *output_buffer,
                 uint32_t crop_height, uint32_t crop_width,
                 uint32_t offset_x, uint32_t offset_y,
                 uint32_t scale_num, uint32_t scale_denom,
                 bool enable_crop,
                 bool hflip)

Finally, can build ffcv by following command without error.

python setup.py bdist_wheel

However, I haven't checked the operation of ffcv on my Windows PC yet.

from ffcv.

GuillaumeLeclerc avatar GuillaumeLeclerc commented on June 26, 2024

That's amazing. Feel tree to make a pull request if you are fine making this available to other users. In the meantime I will close this issue.

from ffcv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.