-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Runtime Environment Query Functions (#126)
* Add runtime environment query functions * Update gauxc_config.hpp.in
- Loading branch information
1 parent
cf6b85c
commit 6a8f4bf
Showing
6 changed files
with
119 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* GauXC Copyright (c) 2020-2024, The Regents of the University of California, | ||
* through Lawrence Berkeley National Laboratory (subject to receipt of | ||
* any required approvals from the U.S. Dept. of Energy). All rights reserved. | ||
* | ||
* See LICENSE.txt for details | ||
*/ | ||
#pragma once | ||
#include <gauxc/gauxc_config.hpp> | ||
#include <gauxc/enums.hpp> | ||
|
||
namespace GauXC { | ||
|
||
inline int gauxc_max_am(ExecutionSpace ex, SupportedAlg alg) { | ||
switch(ex) { | ||
#ifdef GAUXC_HAS_HOST | ||
case ExecutionSpace::Host: | ||
switch(alg) { | ||
case SupportedAlg::XC: | ||
case SupportedAlg::DEN: | ||
return GAUXC_CPU_XC_MAX_AM; | ||
case SupportedAlg::SNLINK: | ||
return GAUXC_CPU_SNLINK_MAX_AM; | ||
default: return -1; | ||
} | ||
#endif | ||
#ifdef GAUXC_HAS_DEVICE | ||
case ExecutionSpace::Device: | ||
switch(alg) { | ||
case SupportedAlg::XC: | ||
case SupportedAlg::DEN: | ||
return GAUXC_GPU_XC_MAX_AM; | ||
case SupportedAlg::SNLINK: | ||
return GAUXC_GPU_SNLINK_MAX_AM; | ||
default: return -1; | ||
} | ||
#endif | ||
default: return -1; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* GauXC Copyright (c) 2020-2024, The Regents of the University of California, | ||
* through Lawrence Berkeley National Laboratory (subject to receipt of | ||
* any required approvals from the U.S. Dept. of Energy). All rights reserved. | ||
* | ||
* See LICENSE.txt for details | ||
*/ | ||
#include "ut_common.hpp" | ||
#include <gauxc/util/environment.hpp> | ||
|
||
using namespace GauXC; | ||
TEST_CASE("Environment", "[env]") { | ||
|
||
SECTION("Host") { | ||
auto xc = gauxc_max_am(ExecutionSpace::Host, SupportedAlg::XC ); | ||
auto den = gauxc_max_am(ExecutionSpace::Host, SupportedAlg::DEN ); | ||
auto snk = gauxc_max_am(ExecutionSpace::Host, SupportedAlg::SNLINK); | ||
|
||
#ifdef GAUXC_HAS_HOST | ||
REQUIRE(xc == GAUXC_CPU_XC_MAX_AM); | ||
REQUIRE(den == GAUXC_CPU_XC_MAX_AM); | ||
REQUIRE(snk == GAUXC_CPU_SNLINK_MAX_AM); | ||
#else | ||
REQUIRE(xc == -1); | ||
REQUIRE(den == -1); | ||
REQUIRE(snk == -1); | ||
#endif | ||
} | ||
|
||
SECTION("Device") { | ||
auto xc = gauxc_max_am(ExecutionSpace::Device, SupportedAlg::XC ); | ||
auto den = gauxc_max_am(ExecutionSpace::Device, SupportedAlg::DEN ); | ||
auto snk = gauxc_max_am(ExecutionSpace::Device, SupportedAlg::SNLINK); | ||
|
||
#ifdef GAUXC_HAS_DEVICE | ||
REQUIRE(xc == GAUXC_GPU_XC_MAX_AM); | ||
REQUIRE(den == GAUXC_GPU_XC_MAX_AM); | ||
REQUIRE(snk == GAUXC_GPU_SNLINK_MAX_AM); | ||
#else | ||
REQUIRE(xc == -1); | ||
REQUIRE(den == -1); | ||
REQUIRE(snk == -1); | ||
#endif | ||
} | ||
|
||
} |