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

SYCL parallelization #101

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
endif ()

if(DEFINED CMAKE_BUILD_TYPE)
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb")
set(BOOST_FORCEINLINE "OFF") # improves debugging traces
endif()
#if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb")
#set(BOOST_FORCEINLINE "OFF") # improves debugging traces
#endif()
endif()

option(SANITIZE "Build sanitizers" FALSE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ namespace nil::crypto3::multiprecision {
// Assignment

template<typename T,
std::enable_if_t<std::is_integral_v<T> && std::is_unsigned_v<T>, int> = 0>
std::enable_if_t<std::is_integral_v<T> && std::is_unsigned_v<T> || std::is_same_v<T, unsigned __int128>, int> = 0>
constexpr void do_assign_integral(const T& a) noexcept {
if constexpr (sizeof(T) <= sizeof(limb_type)) {
this->limbs()[0] = a;
Expand Down Expand Up @@ -209,7 +209,7 @@ namespace nil::crypto3::multiprecision {
}

template<typename T,
std::enable_if_t<std::is_integral_v<T> && std::is_unsigned_v<T>, int> = 0>
std::enable_if_t<std::is_integral_v<T> && std::is_unsigned_v<T> || std::is_same_v<T, unsigned __int128>, int> = 0>
constexpr big_uint& operator=(T val) noexcept {
do_assign_integral(val);
return *this;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#if defined(__SIZEOF_INT128__)
#define NIL_CO3_MP_HAS_INT128
#endif
//#if defined(__SIZEOF_INT128__)
//#define NIL_CO3_MP_HAS_INT128
//#endif

// same again for __int128:
#if defined(NIL_CO3_MP_HAS_INT128) && defined(__cplusplus)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "nil/crypto3/multiprecision/detail/helper_macros.hpp"
#include "nil/crypto3/multiprecision/detail/int128.hpp"

#if __has_include(<immintrin.h>)
/*#if __has_include(<immintrin.h>)

#define NIL_CO3_MP_HAS_IMMINTRIN_H

Expand Down Expand Up @@ -53,4 +53,4 @@ namespace nil::crypto3::multiprecision::detail {

#endif

#endif
#endif*/
21 changes: 21 additions & 0 deletions find_symbol.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Symbol to search for
SYMBOL="$2"

# Check if a directory was provided
if [ -z "$1" ]; then
echo "Usage: $0 /path/to/directory symbol"
exit 1
fi

# Directory to search
DIR="$1"

# Find all .so and .a files and process them
find "$DIR" -type f \( -name '*.so*' -o -name '*.a' \) -print0 | while IFS= read -r -d '' file; do
# Run nm and search for the symbol
if nm -D -U "$file" 2>/dev/null | grep -Fq "$SYMBOL"; then
echo "Symbol found in: $file"
fi
done
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
enableDebug = false;
});
parallel-crypto3-tests = (pkgs.callPackage ./parallel-crypto3.nix {
stdenv = pkgs.llvmPackages_19.stdenv;
runTests = true;
enableDebug = false;
});
Expand Down
5 changes: 5 additions & 0 deletions gpu_gpustat_monitor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

while true; do
gpustat --json >> gpu_utilization_gpustat_log.json
done
59 changes: 59 additions & 0 deletions lzpatcher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env bash

# check-rpath.sh

#!/bin/bash

set -e

# Usage function
usage() {
echo "Usage: $0 /path/to/directory"
exit 1
}

# Check if directory is provided
if [ -z "$1" ]; then
usage
fi

DIRECTORY="$1"

# Verify the directory exists
if [ ! -d "$DIRECTORY" ]; then
echo "Error: Directory '$DIRECTORY' does not exist."
exit 1
fi

LIBZ_DIR="/nix/store/2k9k3q1vk8z6w7743k6nb22vnb05xv06-zlib-1.3.1/lib/"
echo "Library directory: $LIBZ_DIR"

# Iterate over all files in the directory
find "$DIRECTORY" -maxdepth 1 -type f | while read -r FILE; do
# Check if file is an ELF executable
if file "$FILE" | grep -q 'ELF'; then
echo "Processing ELF executable: $FILE"

# Backup the original file
cp "$FILE" "$FILE.bak"

# Get existing RPATH
EXISTING_RPATH=$(patchelf --print-rpath "$FILE" || true)

# Determine the new RPATH
if [ -z "$EXISTING_RPATH" ]; then
NEW_RPATH="$LIBZ_DIR"
else
NEW_RPATH="$EXISTING_RPATH:$LIBZ_DIR"
fi

# Modify the RPATH
patchelf --set-rpath "$NEW_RPATH" "$FILE"

echo "Updated RPATH for $FILE to $NEW_RPATH"
else
echo "Skipping non-ELF file: $FILE"
fi
done

echo "RPATH update complete."
Loading