Skip to content

vlang/vsl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

The V Scientific Library

vlang.io | Docs | Examples | Changelog | Contributing

Mentioned in Awesome V VSL Continuous Integration Deploy Documentation Performance Benchmarks License: MIT Modules

VSL is a V library to develop Artificial Intelligence and High-Performance Scientific Computations.

Important

The pure-V QR path (geqrf/orgqr) is still being aligned; the related test is temporarily skipped. Other BLAS/LAPACK routines pass, and C backends (-d vsl_blas_cblas -d vsl_lapack_lapacke) are recommended when you need QR correctness today.

πŸŽ‰ Pure V BLAS/LAPACK: High Performance, Zero Dependencies

VSL now features 100% pure V implementations of BLAS and LAPACK that deliver excellent performance while requiring zero external dependencies. These implementations are production-ready and provide a compelling alternative to C backends.

Key Benefits

  • βœ… Zero Dependencies: No need to install OpenBLAS or LAPACK system libraries
  • βœ… High Performance: Competitive performance with optimized C backends
  • βœ… Cross-Platform: Works consistently across all platforms supported by V
  • βœ… Production Ready: Stable implementations with comprehensive test coverage

Performance Benchmarks

Run comprehensive benchmarks to see performance characteristics:

# BLAS benchmarks
v run benchmarks/blas_bench.v

# LAPACK benchmarks  
v run benchmarks/lapack_bench.v

# Compare backends
v run benchmarks/compare_backends.v

Backend Options

Backend Description Compilation Flag Best For
Pure V 100% V implementation NONE (default) Zero-dependency deployment, cross-platform
OpenBLAS Optimized C library -d vsl_blas_cblas Maximum performance when C libraries available
LAPACKE Standard LAPACK C interface -d vsl_lapack_lapacke Maximum performance for LAPACK operations

Recommendation: Start with the pure V backend for simplicity and zero dependencies. Use C backends when maximum performance is critical and system libraries are available.

See Pure V BLAS/LAPACK Release Notes for detailed information.

πŸ“– Documentation

Visit VSL Documentation to explore all supported features and APIs.

VSL is a comprehensive Scientific Computing Library offering a rich ecosystem of mathematical and computational modules. The library provides both pure-V implementations and optional high-performance backends through established C and Fortran libraries.

πŸ”¬ Core Capabilities

  • Linear Algebra: Complete matrix and vector operations, eigenvalue decomposition, linear solvers
  • Machine Learning: Clustering algorithms (K-means), classification (KNN), regression, and NLP tools
  • Numerical Methods: Differentiation, integration, root finding, polynomial operations
  • Data Visualization: Advanced plotting with Plotly-style API supporting 2D/3D charts
  • Scientific Computing: FFT, statistical analysis, probability distributions
  • Parallel Computing: MPI support and OpenCL acceleration
  • Data I/O: HDF5 integration for scientific data formats

⚑ Performance Architecture

VSL provides flexible performance options:

  • Pure V Implementation: High-performance, dependency-free BLAS/LAPACK implementations
  • Optimized Backends: Optional integration with OpenBLAS, LAPACK, and MPI for maximum performance
  • GPU Acceleration: OpenCL support for computationally intensive operations

Pure V BLAS/LAPACK implementations deliver competitive performance while eliminating external dependencies. Benchmark results demonstrate excellent performance characteristics across a wide range of problem sizes.

Each module clearly documents compilation flags and backend requirements, allowing users to choose the optimal configuration for their specific use case.

πŸš€ Installation & Quick Start

VSL supports multiple installation methods and deployment options to fit different development workflows.

πŸ“¦ Package Manager Installation

Via V's built-in package manager:

v install vsl

Via vpkg:

vpkg get https://github.com/vlang/vsl

🐳 Docker Development Environment (Recommended)

For the best development experience with all optional dependencies pre-configured:

  1. Install Docker on your system

  2. Clone the starter template:

    git clone https://github.com/ulises-jeremias/hello-vsl
    cd hello-vsl
  3. Follow the setup instructions in the template's README

This approach provides:

  • Pre-configured environment with V, VSL, and all optional dependencies
  • Cross-platform compatibility (Windows, Linux, macOS)
  • Isolated development environment
  • Access to optimized BLAS/LAPACK libraries

πŸ”§ System Dependencies (Optional)

For enhanced performance, you can install optional system libraries:

  • OpenBLAS/LAPACK: Linear algebra acceleration
  • OpenMPI: Parallel computing support
  • OpenCL: GPU acceleration
  • HDF5: Scientific data format support

Refer to individual module documentation for specific compilation flags.

πŸ§ͺ Testing

To test the module, just type the following command:

v test .

πŸ“Š Performance Benchmarks

VSL includes comprehensive performance benchmarks using V's built-in benchmark module:

# Run all BLAS benchmarks
v run benchmarks/blas_bench.v

# Run all LAPACK benchmarks
v run benchmarks/lapack_bench.v

# Compare pure V vs C backends
v -d vsl_blas_cblas run benchmarks/compare_backends.v

Benchmark results show performance characteristics for:

  • BLAS Level 1: Vector operations (dot product, norms, scaling)
  • BLAS Level 2: Matrix-vector operations (GEMV, GER)
  • BLAS Level 3: Matrix-matrix operations (GEMM, SYRK)
  • LAPACK: Linear system solvers, factorizations, eigenvalue problems

See benchmarks/README.md for detailed benchmark documentation.

πŸ‘₯ Contributors

Made with contributors-img.