<commit_before>#!/bin/bash -e

J="-j2"
if [[ -z $CI ]]; then
  J="-j6"
fi

if [ -z "$CAFFE_ROOT" ]; then
  cd $(dirname $0)

  # Download caffe
  SHA=24d2f67173db3344141dce24b1008efffbfe1c7d
  if [[ ! -d caffe ]]; then
    echo Downloading caffe
    git clone <EMAIL>:BVLC/caffe.git
    git -C caffe checkout $SHA
    pushd caffe
    git am ../patch/0001-Fix-veclib-path-for-OSX-sierra.patch
    popd
  fi

  # Install caffe
  if [[ ! -f caffe/build/lib/libcaffe.dylib && ! -f caffe/build/lib/libcaffe.so ]]; then
    echo "Compiling caffe"
    pushd caffe
    mkdir -p build
    pushd build
    cmake \
      -DCPU_ONLY=ON \
      -DBUILD_python=OFF \
      -DBUILD_matlab=OFF \
      -DUSE_LEVELDB=OFF \
      -DUSE_LMDB=OFF \
      -DBUILD_docs=OFF \
      ..
    make all $J
    popd
    popd
  else
    echo "Caffe already compiled; skipping compilation"
  fi
else
  echo "Using caffe from $CAFFE_ROOT"
fi<commit_msg>Support GPU compilation for node-caffe<commit_after>#!/bin/bash -e

J="-j2"
if [[ -z $CI ]]; then
  J="-j6"
fi

if [ -z "$CAFFE_ROOT" ]; then
  cd $(dirname $0)

  # Download caffe
  SHA=24d2f67173db3344141dce24b1008efffbfe1c7d
  if [[ ! -d caffe ]]; then
    echo Downloading caffe
    git clone <EMAIL>:BVLC/caffe.git
    git -C caffe checkout $SHA
    pushd caffe
    git am ../patch/0001-Fix-veclib-path-for-OSX-sierra.patch
    popd
  fi

  # Check for NVIDIA GPU. If NVIDIA GPU is unavailable
  # `nvidia-smi` command returns with an empty string.
  # Given that scenario revert back to CPU mode, else
  # compile with GPU support
  if which nvidia-smi; then
    hasGPU=true
  else
    hasGPU=false
  fi

  # Install caffe
  if [[ ! -f caffe/build/lib/libcaffe.dylib && ! -f caffe/build/lib/libcaffe.so ]]; then
    echo "Compiling caffe"
    pushd caffe
    mkdir -p build
    pushd build

    # Enable CPU/GPU
    if $hasGPU; then
      cpu_mode=OFF
      cudnn_mode=ON
    else
      cpu_mode=ON
      cudnn_mode=OFF
    fi

    cmake \
      -DCPU_ONLY=$cpu_mode \
      -DUSE_CUDNN=$cudnn_mode \
      -DBUILD_python=OFF \
      -DBUILD_matlab=OFF \
      -DUSE_LEVELDB=OFF \
      -DUSE_LMDB=OFF \
      -DBUILD_docs=OFF \
      ..

    make all $J
    popd
    popd
  else
    echo "Caffe already compiled; skipping compilation"
  fi
else
  echo "Using caffe from $CAFFE_ROOT"
fi
{'fraction_non_alphanumeric': 0.10890233362143474, 'fraction_numerical': 0.02592912705272256, 'mean_word_length': 2.2790368271954673, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '330859', 'n_tokens_mistral': 964, 'n_tokens_neox': 882, 'n_words': 224}