Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -M option for machine-readable JSON output #27

Merged
merged 19 commits into from
Oct 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ set(TASK_SPOOLER_SOURCES
server.c
server_start.c
signals.c
tail.c)
tail.c
cjson/cJSON.c)

if(TASK_SPOOLER_COMPILE_CUDA)
set(TASK_SPOOLER_SOURCES ${TASK_SPOOLER_SOURCES} gpu.c)
Expand All @@ -52,8 +53,31 @@ add_executable(
add_executable(makeman man.c)

if(TASK_SPOOLER_COMPILE_CUDA)
find_package(CUDAToolkit)
target_link_libraries(${target} CUDA::nvml)
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
find_package(CUDA REQUIRED)

# Do what the new package does
find_library(CUDA_DRIVER_LIBRARY
NAMES cuda_driver cuda
HINTS ${CUDA_TOOLKIT_ROOT_DIR}
ENV CUDA_PATH
PATH_SUFFIXES nvidia/current lib64 lib/x64 lib)
if (NOT CUDA_DRIVER_LIBRARY)
# Don't try any stub directories until we have exhausted all other search locations.
find_library(CUDA_DRIVER_LIBRARY
NAMES cuda_driver cuda
HINTS ${CUDA_TOOLKIT_ROOT_DIR}
ENV CUDA_PATH
PATH_SUFFIXES lib64/stubs lib/x64/stubs lib/stubs stubs)
endif ()
mark_as_advanced(CUDA_DRIVER_LIBRARY)
##

target_link_libraries(${target} nvidia-ml)
else()
find_package(CUDAToolkit REQUIRED)
target_link_libraries(${target} CUDA::nvml)
endif()
else(TASK_SPOOLER_COMPILE_CUDA)
message("Installing a CPU version...")
add_definitions(-DCPU)
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ OBJECTS=main.o \
print.o \
info.o \
env.o \
tail.o
tail.o \
cjson/cJSON.o
TARGET=ts
INSTALL=install -c

Expand Down Expand Up @@ -56,6 +57,7 @@ list.o: list.c main.h
tail.o: tail.c main.h
gpu.o: gpu.c main.h
$(CC) $(CFLAGS) $(CPPFLAGS) -L$(CUDA_HOME)/lib64 -I$(CUDA_HOME)/include -lpthread -c $< -o $@
cjson/cJSON.o: cjson/cJSON.c cjson/cJSON.h

cpu: CFLAGS+=-DCPU

Expand All @@ -68,7 +70,7 @@ ifeq ($(GIT_REPO), true)
endif

clean:
rm -f *.o $(TARGET) makeman ts.1
rm -f *.o cjson/*.o $(TARGET) makeman ts.1

install: $(TARGET)
$(INSTALL) -d $(PREFIX)/bin
Expand Down
Loading