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

Can this be compiled to run on Windows 10, or Windows XP? #516

Open
MartialTerran opened this issue May 6, 2024 · 4 comments
Open

Can this be compiled to run on Windows 10, or Windows XP? #516

MartialTerran opened this issue May 6, 2024 · 4 comments

Comments

@MartialTerran
Copy link

Assuming that a Windows 10 machine can run this code, can this run.c lllama2 be modified to be complied to run inference mode on a Windows 10 machine?
I asked Google Gemini 1.5 Pro this question and this is Gemini's response:

Compiling and Running the Code on Windows 10
While the provided code appears to be primarily written in C, it includes some POSIX-specific elements like mmap and munmap which are not directly available on Windows 10. Therefore, running this code directly on Windows 10 would require some modifications and additional libraries.
Here's a potential approach:

  1. Replacing POSIX Functions:
    Memory Mapping:
    Use the Windows API functions CreateFileMapping, MapViewOfFile, and UnmapViewOfFile to achieve similar functionality as mmap and munmap.
    Libraries like Boost.Interprocess could also provide cross-platform memory mapping solutions.
    Other Functions:
    Review the code for other potential POSIX-specific functions and find equivalent Windows API functions or libraries.
  2. Compiler and Libraries:
    Compiler:
    Use a C compiler compatible with Windows, such as Microsoft Visual C++, MinGW, or Clang.
    Libraries:
    Ensure any required libraries (e.g., for linear algebra operations) have Windows versions or alternatives.
  3. Code Structure:
    Conditional Compilation:
    The code already utilizes #if defined _WIN32 blocks. Adapt these sections to incorporate the necessary Windows-specific implementations.
    Consider creating separate source files for platform-specific code to maintain clarity.
  4. Building and Running:
    Use the chosen compiler and build system to compile the code into an executable.
    Run the executable from the command line, providing the required arguments (checkpoint path, options).
    Additional Considerations:
    OpenMP: The code utilizes OpenMP for parallelization. Ensure you have a compatible OpenMP library and compiler flags set up for Windows.
    Testing: Thoroughly test the modified code on Windows 10 to ensure functionality and performance.
    Tools and Libraries:
    Microsoft Visual Studio
    MinGW
    Clang
    Boost C++ Libraries
    OpenMP library for Windows
    Disclaimer:
    Modifying the code to run on Windows 10 requires some C programming and Windows API knowledge. This response provides a general direction, and specific implementation details may vary.
@jameswdelancey
Copy link
Contributor

lol. yea absolutely. there is a small fix you need to compile it to run models over 4gig, like llama 7b. Just compile it with ming64 and run it first.

@jameswdelancey
Copy link
Contributor

#513

@MartialTerran
Copy link
Author

MartialTerran commented May 11, 2024 via email

@sweiglbosker
Copy link

Looking at the Makefile i see no compatibility issues with mingw. You can probably just clone the repo and run make in the root directory.

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