Code Monkey home page Code Monkey logo

llm.sycl's Introduction

LLM.SYCL

This project is basically a partial translation of LLM.C repository from C-CUDA to C++ SYCL.

Contact

Please feel free to contact me anytime via GitHub Issues or Email: salehjamaligolzar [at] gmail [dot] com .

How to

Prepare

You need to have the oneAPI and CUDA SDKs installed. The code has been tested with the following versions:

  • oneAPI: 2021.4
  • CUDA: 12.2

Furthermore, you need to have numpy, torch, and python3 installed to run the training. The dataset will be fetched automatically.

Train

Refer to the readme file in data/ for training the model. This is required to run the CUDA and the SYCL implementations.

Build

Source the oneAPI and CUDA environment and then:

mkdir build && cd build
CC=icx CXX=icpx cmake ..
# ccmake ..
make -j

This will give you the LLM_SYCL, OrigTrain, and TestAll executables.

Run

To run the original CUDA code with minor modifications to disable training and to perform some intermediate tensor dumping as gold values:

./OrigTrain -b 1

To run the SYCL code:

./LLM_SYCL -s --batch 1 -x -g 10 -y

Set -g for larger values to generate more text. See -h for more details.

To run the test suite:

./TestAll

Verify

The output of the SYCL code should be similar to the output of the CUDA code. Other than that, for more detailed comparison with the gold (CUDA) implementation, you can use the data/compare.py script:

./build/OrigTrain -b 1
./build/LLM_SYCL -s --batch 1 -g 10
python data/compare.py

Note that we are running the SYCL implementation with profiling and intermediate tensor dumping enabled. This is the default config for the modified CUDA implementation.

Credits

This repo is developed as the final project for the HPC course 2024 of Prof. B. Cosenza at the University of Salerno. The following open-source projects have been used:

llm.sycl's People

Contributors

salehjg avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

salehjg

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.