Skip to content

Commit

Permalink
Merge pull request #2 from biocad/akhoroshev/conan-cmake
Browse files Browse the repository at this point in the history
Update Conan
  • Loading branch information
akhoroshev authored Nov 20, 2020
2 parents d80f4ec + 9144969 commit 714f02c
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 68 deletions.
29 changes: 11 additions & 18 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
stages:
- build
- deploy

build-test:
extends: .cuda-build-test

build-test-upload:
build-test-upload-branch:
extends: .cuda-build-test-upload
only:
- branches
except:
- master

build-test-upload-tag:
extends: .cuda-build-test-upload
only:
- tags

deploy-hpc:
extends: .cuda-deploy-hpc

include:
- project: 'biocad/bcd-ci-common'
ref: master
file: '/build/cuda/build-test.yaml'

- project: 'biocad/bcd-ci-common'
ref: master
ref: akhoroshev/update-cuda-pipelines
file: '/build/cuda/build-test-upload.yaml'

- project: 'biocad/bcd-ci-common'
ref: master
file: '/build/cuda/cuda-deploy.yaml'

52 changes: 22 additions & 30 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,50 +1,42 @@
cmake_minimum_required(VERSION 3.10)

project(cuq LANGUAGES CXX)
project(cuq LANGUAGES CXX CUDA)

set(CMAKE_CUDA_STANDARD 14)
set(CMAKE_CXX_STANDARD 14)

set(CMAKE_CUDA_FLAGS "-lineinfo")

set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler -Werror") #flags to host compiler behind the nvcc
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Werror cross-execution-space-call,reorder,deprecated-declarations")

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS "-O2 -Wall -Wextra -Wshadow -Wpedantic -Wnon-virtual-dtor -Wunused -Wdouble-promotion")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -rdynamic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")


include_directories("${PROJECT_SOURCE_DIR}/include")

#
# Library
#
add_library(cuq SHARED
src/cuq.cpp
src/device_selection.cu
)
target_link_libraries(cuq rt cudart nvidia-ml)
add_library(cuq
src/cuq.cpp
src/device_selection.cu
)
target_include_directories(cuq PUBLIC include/)
target_include_directories(cuq PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
target_link_libraries(cuq cudart nvidia-ml)
set_target_properties(
cuq
PROPERTIES
CUDA_SEPARABLE_COMPILATION ON
CUDA_RESOLVE_DEVICE_SYMBOLS ON
POSITION_INDEPENDENT_CODE ON
)

install(TARGETS cuq DESTINATION lib)
install(FILES include/cuq.h DESTINATION include)

add_executable(concurrent_gpu_test
examples/concurrent_gpu_demo.cu
)
set_target_properties( concurrent_gpu_test
PROPERTIES CUDA_SEPARABLE_COMPILATION ON
POSITION_INDEPENDENT_CODE ON
)
target_link_libraries(concurrent_gpu_test PRIVATE cudart cuq)

#
# Tests sub directory
#
add_subdirectory(tests)
# Example
add_executable(concurrent_gpu_demo
examples/concurrent_gpu_demo.cu
)
target_link_libraries(concurrent_gpu_demo cuq)

# Tests
include(CTest)
add_test (all_tests tests/all_tests)

# set(CMAKE_BUILD_TYPE Debug)
add_subdirectory(tests)
36 changes: 27 additions & 9 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
from conans import ConanFile
from conans import ConanFile, CMake


class Conan(ConanFile):
python_requires = "BcdConanRecipe/v1.0.0@biocad/biocad"
python_requires_extend ="BcdConanRecipe.BcdConanRecipe"
name = "cuq"
url = "https://github.com/biocad/cuq"
description = "CUDA multi-GPU concurrent tasks queue"
settings = "os", "build_type", "arch","compiler","CUDA"
options = {"shared": [True, False]}
default_options = "shared=True"
generators = "cmake_find_package"
exports_sources="*"
settings = "os", "build_type", "arch", "compiler", "CUDA"
generators = "cmake"
exports_sources = "*"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
cmake.parallel = False
cmake.test()

def package(self):
cmake = CMake(self)
cmake.configure()
cmake.install()

def package_info(self):
self.cpp_info.libs = ["cuq"]
# users will be able to link statically with our library
# but this requires the following system libraries
self.cpp_info.system_libs = ["cudart", "nvidia-ml", "stdc++"]
self.cpp_info.libdirs.append("/usr/local/cuda/lib64")

def deploy(self):
self.copy("*", dst="include", src="include")
self.copy("*", dst="lib", src="lib")
3 changes: 2 additions & 1 deletion include/cuq.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#pragma once

#include <mutex>
#include <queue>
#include <functional>

#pragma once

class GPUTask {
public:
Expand Down
19 changes: 10 additions & 9 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
include_directories("${PROJECT_SOURCE_DIR}/tests")
cmake_minimum_required(VERSION 3.10)

add_executable(all_tests
device_selection/device_selection_tests.cu
)

set_target_properties(all_tests PROPERTIES
CUDA_SEPARABLE_COMPILATION ON
POSITION_INDEPENDENT_CODE ON
add_executable(device_selection_test
device_selection/device_selection_tests.cu
)
target_link_libraries(all_tests PRIVATE cuq cudart)
target_include_directories(device_selection_test PRIVATE catch2)

target_link_libraries(device_selection_test cuq)
add_test(
NAME device_selection_test
COMMAND device_selection_test
)
2 changes: 1 addition & 1 deletion tests/device_selection/device_selection_tests.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include "catch.hpp"

#include <stdlib.h>
#include <iostream>
Expand Down

0 comments on commit 714f02c

Please sign in to comment.