Skip to content

Commit 2f6e828

Browse files
author
Daniil Efremov
authored
Merge pull request #85 from dividiti/issue-84
Issue 84
2 parents bd448b5 + ba2262e commit 2f6e828

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ android:
77
components:
88
- platform-tools
99
- tools
10-
- build-tools-23.0.2
10+
- build-tools-25.0.0
1111
- android-22
1212
- extra-android-m2repository
1313
- extra-google-m2repository

app/src/main/java/openscience/crowdsource/video/experiments/AppConfigService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
//todo it's better to implement all services using IoC
2828
public class AppConfigService {
2929

30-
public static final String DATA_LOCAL_TMP_VIENNACL_CACHE = "/data/local/tmp/viennacl_cache_";
30+
public static final String DATA_LOCAL_TMP_VIENNACL_CACHE = "/data/local/tmp/viennacl_cache/";
3131
private final static String APP_CONFIG_DIR = "/sdcard/openscience/"; //todo get log dir from common config service
3232
private final static String APP_CONFIG_FILE_PATH = APP_CONFIG_DIR + "app_config.json";
3333

app/src/main/java/openscience/crowdsource/video/experiments/MainActivity.java

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ protected String doInBackground(String... arg0) {
763763
publishProgress("\nUnfortunately, no scenarios found for your device ...");
764764
return null;
765765
}
766-
766+
String localAppPath = AppConfigService.getLocalAppPath() + File.separator + "openscience" + File.separator;
767767
for (int i = 0; i < scenarios.length(); i++) {
768768
JSONObject scenario = scenarios.getJSONObject(i);
769769
final String module_uoa = scenario.getString("module_uoa");
@@ -845,7 +845,6 @@ public void println(String text) {
845845
// copyToAppSpace is not mandatory
846846
}
847847
if (copyToAppSpace != null && copyToAppSpace.equalsIgnoreCase("yes")) {
848-
String localAppPath = AppConfigService.getLocalAppPath() + File.separator + "openscience" + File.separator;
849848
String fileAppDir = localAppPath + file.getString("path");
850849
File appfp = new File(fileAppDir);
851850
if (!appfp.exists()) {
@@ -933,13 +932,24 @@ public void println(String text) {
933932
String openCLlibPath = null;
934933
openCLlibPath = patchOpenCLIfRequired();
935934

935+
String viennaclCachePath = "";
936+
936937
if (openCLlibPath != null) {
937938
libPath = libPath + ":" + openCLlibPath;
939+
viennaclCachePath = localAppPath + File.separator + "viennacl_cache"+ File.separator;
940+
File appfp = new File(viennaclCachePath);
941+
if (!appfp.exists()) {
942+
if (!appfp.mkdirs()) {
943+
publishProgress("\nError creating dir (" + viennaclCachePath + ") ...");
944+
return null;
945+
}
946+
}
947+
938948
}
939949
String[] scenarioEnv = {
940950
"CT_REPEAT_MAIN=" + String.valueOf(1),
941951
"LD_LIBRARY_PATH=" + libPath + ":$LD_LIBRARY_PATH",
942-
"VIENNACL_CACHE_PATH=" + DATA_LOCAL_TMP_VIENNACL_CACHE
952+
"VIENNACL_CACHE_PATH=" + viennaclCachePath
943953
};
944954
publishProgress("Prepared scenario env " + scenarioEnv[0]);
945955
publishProgress("Prepared scenario env " + scenarioEnv[1]);
@@ -1016,6 +1026,17 @@ public void run() {
10161026
}
10171027
publishProgress("\nRecognition result:" + recognitionRawResultText);
10181028

1029+
1030+
if (viennaclCachePath != null && !viennaclCachePath.trim().equals("")) {
1031+
String[] lsCacheResult = openme.openme_run_program("ls " + viennaclCachePath, null, viennaclCachePath);
1032+
if (!lsCacheResult [1].isEmpty()) {
1033+
publishProgress("ViennaCL cache generated " + lsCacheResult[1]);
1034+
} else {
1035+
publishProgress("ViennaCL cache not generated");
1036+
}
1037+
}
1038+
1039+
10191040
publishProgress("Submitting results and unexpected behavior (if any) to the Collective Knowledge Aggregator ...\n");
10201041

10211042
if (getCurl() == null) {

0 commit comments

Comments
 (0)