ECP-VeloC / AXL

Asynchronous Transfer Library
MIT License
2 stars 8 forks source link

Add pthreads xfer, axl_cp, and update AXL_Add for directories #42

Closed tonyhutter closed 5 years ago

tonyhutter commented 5 years ago
tonyhutter commented 5 years ago

Travis caught this: ../src/libaxl.so: undefined reference to 'pthread_join' Looks like I forgot to update CMakeLists to include -lpthread. Let me fix that...

tonyhutter commented 5 years ago

Travis is hitting a make check failure when running axl_cp. I'll need to update that too

tonyhutter commented 5 years ago

I needed a make check test case for Travis to run, so I wrote a test_axl script which invokes axl_cp. I've included the test_axl script in my latest push. I've also updated my PR comments to reference it.

make check works in my Fedora 29 VM, but it's failing on Travis, so I need to dig into that.

tonyhutter commented 5 years ago

Looks like Travis is erroring out here:

1: Test command: /home/travis/build/ECP-VeloC/AXL/test/test_axl
1: Test timeout computed to be: 9.99988e+06
1: Testing sync transfer... failed copy
1: AXL 0.3.0 ERROR: travis-job-316ad4c6-c516-4ece-a8ba-645769a85db5: axl_async_init_daemon: child process failed to launch: axld /dev/shm/axld: No such file or directory @ axl_async_init_daemon /home/travis/build/ECP-VeloC/AXL/src/axl_async_daemon.c:578
1: AXL_Init() failed (error -1)
1: AXL 0.3.0 ERROR: travis-job-316ad4c6-c516-4ece-a8ba-645769a85db5: axl_async_init_daemon: child process failed to start: axld /dev/shm/axld @ axl_async_init_daemon /home/travis/build/ECP-VeloC/AXL/src/axl_async_daemon.c:601
1: AXL_Init() failed (error -1)
1/1 Test #1: transfer_tests ...................***Failed    5.67 sec

I can reproduce this on my VM when I build with -DAXL_ASYNC_DAEMON=ON like Travis does. It appears to be an existing bug that's unrelated to my change, as I get the same error when running test_axl -s in the master branch:

$ ./test/test_axl -s
Using existing source file /tmp/testfile
AXL 0.3.0 ERROR: fedora29: axl_async_init_daemon: child process failed to launch: axld /dev/shm/axld: No such file or directory @ axl_async_init_daemon /home/hutter/AXL-master/src/axl_async_daemon.c:578
AXL 0.3.0: fedora29: axl_sync_start: Read and copied test_file to /home/hutter/AXL-master/build/test_file_moved with success code 0 @ axl_sync_start /home/hutter/AXL-master/src/axl_sync.c:46

The only reason that Travis is passing on master is that make check is incorrectly calling test_axl with no arguments, and so no tests get run, and thus this axl_async_init_daemon() code is never invoked.

Since this is broken, I'm going to remove -DAXL_ASYNC_DAEMON=ON from .travis.yml.

CamStan commented 5 years ago

It's not building for me when I pull your branch. Tagging @gonsie to review the cmake.

tonyhutter commented 5 years ago

@CamStan can you pull again and try building? If it's still not working, can you post the build failure?

CamStan commented 5 years ago

It built for me this time. Might have been something on my end that caused my failure last week.

tonyhutter commented 5 years ago

@gonsie thanks AXL_EXTERNAL_LIBS did the trick. It's building now.

gonsie commented 5 years ago

@tonyhutter how do I submit changes back to your branch? I'm not familiar with the all-in-one-commit model.

tonyhutter commented 5 years ago

Hmm.. I don't know if you can push to my branch. You can post you patch directly in a comment and I can apply it. That way all the reviewers can see your proposed change. I've done that in the past for some ZFS code reviews.

tonyhutter commented 5 years ago

Alternatively, you can create a branch with your patch in it and point me to it.

gonsie commented 5 years ago
From 186e5e0dfed377d5d89733541c0fc13b1613d531 Mon Sep 17 00:00:00 2001
From: "Elsa Gonsiorowski (Uranus)" <gonsiorowski1@llnl.gov>
Date: Fri, 31 May 2019 10:11:43 -0700
Subject: [PATCH 1/2] get_nprocs on apple

---
 src/axl_pthread.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/axl_pthread.c b/src/axl_pthread.c
index 3a2950b..d128f84 100644
--- a/src/axl_pthread.c
+++ b/src/axl_pthread.c
@@ -1,11 +1,18 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <pthread.h>
-#include <sys/sysinfo.h>    /* get_nprocs() */
 #include "axl_internal.h"
 #include "kvtree_util.h"
 #include "axl_sync.h"

+/* get_nprocs() */
+#if defined(__APPLE__)
+#include <sys/sysctl.h>
+#else
+#include <sys/sysinfo.h>
+#endif
+
+
 #define MIN(a,b) (a < b ? a : b)

 /*
@@ -200,7 +207,17 @@ int axl_pthread_start (int id)
     file_count = kvtree_size(files);

     /* Get number of hardware threads on our CPU (includes HT) */
+#if defined(__APPLE__)
+    int count;
+    size_t size = sizeof(count);
+    if (sysctlbyname("hw.ncpu",&count,&size,NULL,0)) {
+        cpu_threads = 1;
+    } else {
+        cpu_threads = count;
+    }
+#else
     cpu_threads = get_nprocs();
+#endif

     threads = MIN(cpu_threads, MIN(file_count, MAX_THREADS));

-- 
2.17.2 (Apple Git-113)
gonsie commented 5 years ago

Could you also change the test_axl script name to test_axl.sh?

tonyhutter commented 5 years ago

@gonsie thanks for the patch! I'll apply it and retest. I'll also do the test_axl.sh rename.

gonsie commented 5 years ago

The test is failing on my machine... the temp files that are created cannot be opened by the AXL library (even though they seem to exist). But, I'll stop fiddling with this PR and approve it. We can work on testing later.

tonyhutter commented 5 years ago

@gonsie I included your changes in my latest push.

gonsie commented 5 years ago

looks like the patch I submitted didn't apply cleanly and the sys/sysinfo.h include is still in there. FYI, I just pushed a fix to master.