Skip to content

Commit

Permalink
Merge Fix the preference for Threads
Browse files Browse the repository at this point in the history
This PR fixes the circular dep compilation by fix the preference for Threads before any `find_package`

Related PR: #1388
  • Loading branch information
yhmtsai authored Aug 15, 2023
2 parents f33e709 + 837c389 commit 1eba28a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.16)
project(Ginkgo LANGUAGES C CXX VERSION 1.7.0 DESCRIPTION "A numerical linear algebra library targeting many-core architectures")
set(Ginkgo_VERSION_TAG "develop")
set(PROJECT_VERSION_TAG ${Ginkgo_VERSION_TAG})
# Cuda and Hip also look for Threads. Set it before any find_package to ensure the Threads setting is not changed.
set(THREADS_PREFER_PTHREAD_FLAG ON)

# Determine which modules can be compiled
include(cmake/hip_path.cmake)
Expand Down Expand Up @@ -98,7 +100,7 @@ endif()
if(GINKGO_BUILD_OMP)
find_package(OpenMP 3.0 REQUIRED)
endif()
set(THREADS_PREFER_PTHREAD_FLAG ON)

find_package(Threads REQUIRED)
include(cmake/build_type_helpers.cmake)

Expand Down
3 changes: 3 additions & 0 deletions cmake/GinkgoConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ set(GINKGO_HAVE_VTUNE "@GINKGO_HAVE_VTUNE@")
set(GINKGO_HAVE_METIS "@GINKGO_HAVE_METIS@")
set(VTune_PATH "@VTune_PATH@")

# ensure Threads settings
set(THREADS_PREFER_PTHREAD_FLAG ON)

# NOTE: we do not export benchmarks, examples, tests or devel tools
# so `third_party` libraries are currently unneeded.

Expand Down
2 changes: 1 addition & 1 deletion core/base/mixed_precision_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#else

#define GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_SPLIT1(_macro, ...) \
template _macro(float, float, float, __VA_ARGS__);
template _macro(float, float, float, __VA_ARGS__)

#define GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_SPLIT2(_macro, ...) \
template _macro(double, double, double, __VA_ARGS__)
Expand Down

0 comments on commit 1eba28a

Please sign in to comment.