Skip to content

Commit

Permalink
updated some scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
justanhduc committed Nov 26, 2020
1 parent 90d1e20 commit 220439f
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 13 deletions.
13 changes: 2 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(Task-Spooler C)
set(CMAKE_C_STANDARD 11)

set(CMAKE_CUDA_COMPILER $ENV{CUDA_HOME}/bin/nvcc)
find_package(CUDA REQUIRED)
enable_language(CUDA)
include_directories($ENV{CUDA_HOME}/include)

add_executable(
Expand All @@ -28,13 +28,4 @@ add_executable(
tail.c
)

target_link_libraries(ts ${CUDA_LIBRARIES})

set(
TS_PERMISSIONS
OWNER_WRITE OWNER_READ OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)

install(TARGETS ts DESTINATION /usr/local/bin)
target_link_libraries(ts nvidia-ml)
68 changes: 68 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
PREFIX?=/usr/local
GLIBCFLAGS=-D_XOPEN_SOURCE=500 -D__STRICT_ANSI__
CPPFLAGS+=$(GLIBCFLAGS)
CFLAGS?=-pedantic -ansi -Wall -g -O0 -std=c11
OBJECTS=main.o \
server.o \
server_start.o \
client.o \
msgdump.o \
jobs.o \
execute.o \
msg.o \
mail.o \
error.o \
signals.o \
list.o \
print.o \
info.o \
env.o \
tail.o\
gpu.o
INSTALL=install -c

all: ts

tsretry: tsretry.c

ts: $(OBJECTS)
$(CC) $(LDFLAGS) -o ts $^ -L$(CUDA_HOME)/lib64 -I$(CUDA_HOME)/include -lpthread -lcudart -lcublas -fopenmp -lnvidia-ml

# Test our 'tail' implementation.
ttail: tail.o ttail.o
$(CC) $(LDFLAGS) -o ttail $^


.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<

# Dependencies
main.o: main.c main.h
server_start.o: server_start.c main.h
server.o: server.c main.h
client.o: client.c main.h
msgdump.o: msgdump.c main.h
jobs.o: jobs.c main.h
execute.o: execute.c main.h
msg.o: msg.c main.h
mail.o: mail.c main.h
error.o: error.c main.h
signals.o: signals.c main.h
list.o: list.c main.h
tail.o: tail.c main.h
ttail.o: ttail.c main.h
gpu.o: gpu.c main.h
$(CC) $(CFLAGS) $(CPPFLAGS) -L$(CUDA_HOME)/lib64 -I$(CUDA_HOME)/include -lpthread -c gpu.c

clean:
rm -f *.o ts

install: ts
$(INSTALL) -d $(PREFIX)/bin
$(INSTALL) ts $(PREFIX)/bin
$(INSTALL) -d $(PREFIX)/share/man/man1
$(INSTALL) -m 644 ts.1 $(PREFIX)/share/man/man1

uninstall:
rm -f $(PREFIX)/bin/ts
rm -f $(PREFIX)/share/man/man1/ts.1
6 changes: 4 additions & 2 deletions install
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash

mkdir build && cd build || exit
rm -rf build && mkdir build && cd build || exit
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j 3
sudo make install
sudo install -c -d /usr/local/bin
sudo install -c ts /usr/local/bin
sudo install -c -d /usr/local/share/man/man1
sudo install -c -m 644 ../ts.1 /usr/local/share/man/man1
1 change: 1 addition & 0 deletions main.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Please find the license in the provided COPYING file.
*/
#include <stdio.h>
#include <sys/time.h>

enum {
CMD_LEN = 500,
Expand Down
2 changes: 2 additions & 0 deletions reinstall
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

make clean
make
sudo make uninstall
Expand Down

0 comments on commit 220439f

Please sign in to comment.