Skip to content

Commit 2a31aa0

Browse files
committed
pure cuda code built on macOS 10.13.6
1 parent de1defa commit 2a31aa0

File tree

5 files changed

+39
-8
lines changed

5 files changed

+39
-8
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ docker/Dockerfile*
66
docker/*.dockerfile
77

88
# macOS
9-
.DS_STORE
9+
.DS_Store
10+
._.DS_Store
1011

1112
# Wiki
1213
*.wiki

cmake/device.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,13 @@ target_link_libraries (all.tests
3737
tinkerFToCpp
3838
${__T9_EXTRA_LINK_FLAGS}
3939
)
40+
41+
42+
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
43+
foreach (var tinker9 all.tests)
44+
add_custom_command (TARGET "${var}" POST_BUILD
45+
COMMAND
46+
${CMAKE_INSTALL_NAME_TOOL} -add_rpath "${CUDA_DIR}/lib" "${var}"
47+
)
48+
endforeach ()
49+
endif ()

include/math/libfunc.h

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#pragma once
22
#include "ff/precision.h"
33
#include "seq/seq.h"
4+
45
#include <cmath>
6+
#include <cstdlib>
57

68
// erfc
79
extern "C"
@@ -27,15 +29,34 @@ extern "C"
2729
}
2830
}
2931

30-
// integer functions
31-
#define INT_ABS abs
32+
// abs functions
33+
#if TINKER_CUDART
34+
# define INT_ABS abs
35+
36+
# if TINKER_REAL_SIZE == 8
37+
# define REAL_ABS fabs
38+
# endif
39+
40+
# if TINKER_REAL_SIZE == 4
41+
# define REAL_ABS fabsf
42+
# endif
43+
#else
44+
# define INT_ABS std::abs
45+
46+
# if TINKER_REAL_SIZE == 8
47+
# define REAL_ABS std::fabs
48+
# endif
49+
50+
# if TINKER_REAL_SIZE == 4
51+
# define REAL_ABS std::fabsf
52+
# endif
53+
#endif
3254

3355
// double
3456
#if TINKER_REAL_SIZE == 8
3557
# define REAL_SQRT sqrt
3658
# define REAL_EXP exp
3759
# define REAL_FLOOR floor
38-
# define REAL_ABS fabs
3960
# define REAL_POW pow
4061
# define REAL_RECIP(x) (1 / static_cast<double>(x))
4162
# define REAL_RSQRT(x) (1 / sqrt(x))
@@ -59,7 +80,6 @@ extern "C"
5980
# define REAL_SQRT sqrtf
6081
# define REAL_EXP expf
6182
# define REAL_FLOOR floorf
62-
# define REAL_ABS fabsf
6383
# define REAL_POW powf
6484
# define REAL_RECIP(x) (1 / static_cast<float>(x))
6585
# define REAL_RSQRT(x) (1 / sqrtf(x))

src/xinfo.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ void xInfo(int, char**)
113113
out, f2d, "Number of CUDA cores:", a.cores_per_multiprocessor * a.multiprocessor_count);
114114
const double B_to_GB = 1024. * 1024. * 1024.;
115115
print(out, fm2, "Used/Total GPU memory:",
116-
format("%.2f % / %.2f GB", 100.0 - 100.0 * a.free_mem_bytes / a.total_mem_bytes,
116+
format("%.2f %% / %.2f GB", 100.0 - 100.0 * a.free_mem_bytes / a.total_mem_bytes,
117117
a.total_mem_bytes / B_to_GB));
118118
}
119119
}

test/aplusliquid.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ TEST_CASE("APlus-Liquid-Alyz", "[ff][aplus]")
2727
auto ref_v = r.getVirial();
2828
auto ref_g = r.getGradient();
2929

30-
const double eps_e = testGetEps(0.0007, 0.0001);
30+
const double eps_e = testGetEps(0.0009, 0.0001);
3131
const double eps_g = testGetEps(0.0003, 0.0001);
3232
const double eps_v = testGetEps(0.001, 0.001);
3333

@@ -100,7 +100,7 @@ TEST_CASE("APlus-Liquid", "[ff][aplus]")
100100
auto ref_v = r.getVirial();
101101
auto ref_g = r.getGradient();
102102

103-
const double eps_e = testGetEps(0.0007, 0.0001);
103+
const double eps_e = testGetEps(0.0009, 0.0001);
104104
const double eps_g = testGetEps(0.0003, 0.0001);
105105
const double eps_v = testGetEps(0.001, 0.001);
106106

0 commit comments

Comments
 (0)